diff --git a/.github/workflows/upload_artifacts_workflow.yml b/.github/workflows/upload_artifacts_workflow.yml index 2340286938..579aa8b390 100644 --- a/.github/workflows/upload_artifacts_workflow.yml +++ b/.github/workflows/upload_artifacts_workflow.yml @@ -30,20 +30,41 @@ jobs: echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV echo "WORKFLOW_LINK=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV - - name: Add a comment to the PR + # Comment with a link to the workflow (or update existing comment on rerun). + # Required, as this is a triggered workflow, and does not appear on the PR status page. + - name: Find Comment if: env.PR_NUMBER != '' - uses: actions/github-script@v6 + uses: starkware-libs/find-comment@v3 + id: find-comment with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const workflowLink = process.env.WORKFLOW_LINK; - github.rest.issues.createComment({ - issue_number: process.env.PR_NUMBER, - owner: context.repo.owner, - repo: context.repo.repo, - body: `Artifacts upload triggered. [View details here](${workflowLink})` - }) + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ env.PR_NUMBER }} + comment-author: 'github-actions[bot]' + body-includes: Artifacts upload workflows + - name: Create comment + # If the PR number is found and the comment is not found, create a new comment. + if: env.PR_NUMBER != '' && steps.find-comment.outputs.comment-id == '' + uses: starkware-libs/create-or-update-comment@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + issue-number: ${{ env.PR_NUMBER }} + body: | + Artifacts upload workflows: + * [Started at ${{ github.event.workflow_run.run_started_at }}](${{ env.WORKFLOW_LINK }}) + + - name: Update comment + # If the PR number is found and the comment exists, update it. + if: env.PR_NUMBER != '' && steps.find-comment.outputs.comment-id != '' + uses: starkware-libs/create-or-update-comment@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + comment-id: ${{ steps.find-comment.outputs.comment-id }} + edit-mode: append + body: | + * [Started at ${{ github.event.workflow_run.run_started_at }}](${{ env.WORKFLOW_LINK }}) + + # Build artifact. - uses: ./.github/actions/bootstrap - name: Build native blockifier run: ./build_native_in_docker.sh scripts/build_native_blockifier.sh