From e14f8ded2d980f79680627545f65632c21997ed5 Mon Sep 17 00:00:00 2001 From: Robbie Davis Date: Thu, 12 Aug 2021 14:04:25 -0400 Subject: [PATCH] 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 --- .github/pr.txt | 0 .github/workflows/nightly-docker.yml | 32 ++++++++++++++++++++++------ .github/workflows/sonar-scan.yml | 28 +++++++++++++----------- 3 files changed, 42 insertions(+), 18 deletions(-) create mode 100644 .github/pr.txt diff --git a/.github/pr.txt b/.github/pr.txt new file mode 100644 index 000000000..e69de29bb diff --git a/.github/workflows/nightly-docker.yml b/.github/workflows/nightly-docker.yml index 9f57c8974..6205ca1cc 100644 --- a/.github/workflows/nightly-docker.yml +++ b/.github/workflows/nightly-docker.yml @@ -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 }} diff --git a/.github/workflows/sonar-scan.yml b/.github/workflows/sonar-scan.yml index 51e0f6370..0da7a6f22 100644 --- a/.github/workflows/sonar-scan.yml +++ b/.github/workflows/sonar-scan.yml @@ -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 }} \ No newline at end of file + token: ${{ secrets.REPO_GHA_PAT }}