diff --git a/.github/workflows/upload-s3.yml b/.github/workflows/upload-s3.yml index 33ed6b509..6ed58ca24 100644 --- a/.github/workflows/upload-s3.yml +++ b/.github/workflows/upload-s3.yml @@ -5,8 +5,11 @@ on: types: - completed jobs: - download: + upload-s3: runs-on: ubuntu-latest + if: >- + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'success' steps: - name: Find associated pull request id: pr @@ -26,7 +29,7 @@ jobs: console.info("Pull request number is", pullRequestNumber) return pullRequestNumber - name: 'Download artifact' - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: script: | let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({ @@ -55,7 +58,10 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_DEFAULT_REGION: us-east-1 - name: Comment on PR - run: 'gh pr comment --edit-last https://github.com/$GITHUB_REPOSITORY/pull/$GITHUB_PR --body "Try the dev build for this PR: https://acquia-cli.s3.amazonaws.com/builds/$GITHUB_SHA/acli.phar"' - env: - GH_TOKEN: ${{ github.token }} - GITHUB_PR: ${{ steps.pr.outputs.result }} + run: | + GITHUB_PR=${{ steps.pr.outputs.result }} + GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} + COMMENT="Try the dev build for this PR: https://acquia-cli.s3.amazonaws.com/builds/$GITHUB_SHA/acli.phar" + COMMENT_URL="https://github.com/$GITHUB_REPOSITORY/pull/$GITHUB_PR" + gh pr comment --edit-last $COMMENT_URL --body "$COMMENT" || gh pr comment $COMMENT_URL --body "$COMMENT" +