Feature/new discord action (#489)

* Updating docker action

* adding version to message

* adding way to get PR title and body

* Adding input pass to workflows

Workflow dispatches may not get push header info. Switching logic to pass needed title and body info through just in case.

* adding token

The description on this action is awful, it didn't mention needing a token. I found this solution from the repo's issues

* parsing pr body

* Updating parsing

* Updating docker workflow

* Reverting back to default variables

* fixing syntax error

* removing heading syntax

* updating parse

* Updating parsing

* Updating docker workflow

* trying to remove newline

* updating parsing

* Replacement in parsing

* Update sonar-scan.yml

* testing passing pr body via artifact

* Updating syntax
This commit is contained in:
Robbie Davis 2021-08-12 14:04:25 -04:00 committed by GitHub
parent 21fa4330d4
commit e14f8ded2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 18 deletions

0
.github/pr.txt vendored Normal file
View File

View File

@ -7,10 +7,7 @@ on:
description: "PR Title"
required: true
default: ""
body:
description: "PR Body"
required: true
default: ""
jobs:
docker:
name: Building Nightly Docker
@ -22,6 +19,29 @@ jobs:
with:
ref: develop
- name: Download PR Body
uses: dawidd6/action-download-artifact@v2
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: sonar-scan.yml
path: .github/
- name: Get PR body
uses: pCYSl5EDgo/cat@master
id: prbody
with:
path: .github/pr.txt
- name: Parse PR body
run: |
body='${{ steps.findPr.outputs.body }}'
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo $body
echo "::set-output name=BODY::$body"
id: parse-body
- name: NodeJS to Compile WebUI
uses: actions/setup-node@v2.1.5
with:
@ -90,7 +110,7 @@ jobs:
uses: rjstone/discord-webhook-notify@v1
with:
severity: info
description: v${{steps.get-version.outputs.assembly-version}}
details: '${{ github.event.inputs.body }}'
description: v${{steps.get-version.outputs.assembly-version}} - ${{ github.event.inputs.title }}
details: '${{ steps.parse-body.outputs.BODY }}'
text: A new nightly build has been released for docker.
webhookUrl: ${{ secrets.DISCORD_DOCKER_UPDATE_URL }}

View File

@ -133,23 +133,27 @@ jobs:
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Parse PR body
run: |
body='${{ steps.findPr.outputs.body }}'
echo $body
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo $body
echo "::set-output name=BODY::$body"
id: parse-body
- name: Write PR body
uses: DamianReeves/write-file-action@latest
with:
path: ${{ env.home }}/.github/pr.txt
contents: |
body='${{ steps.findPr.outputs.body }}'
echo $body
write-mode: overwrite
- name: Upload PR Body as Artifact
uses: actions/upload-artifact@v2
with:
name: prbody
path: .github/pr.txt
- name: If Push to Develop, Trigger Docker Stable
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Build Nightly Docker
token: ${{ secrets.REPO_GHA_PAT }}
inputs: '{ "title": "${{ steps.findPr.outputs.title }}", "body": "${{ steps.parse-body.outputs.BODY }}" }'
inputs: '{ "title": "${{ steps.findPr.outputs.title }}" }'
stable:
name: Trigger Stable Docker if Main push
@ -162,4 +166,4 @@ jobs:
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Build Stable Docker
token: ${{ secrets.REPO_GHA_PAT }}
token: ${{ secrets.REPO_GHA_PAT }}