Skip to content

Commit

Permalink
fix(ci): make upload artifacts job edit the comment (#2054)
Browse files Browse the repository at this point in the history
Signed-off-by: Dori Medini <dori@starkware.co>
  • Loading branch information
dorimedini-starkware authored Nov 24, 2024
1 parent 29f5d16 commit 2a5be50
Showing 1 changed file with 32 additions and 11 deletions.
43 changes: 32 additions & 11 deletions .github/workflows/upload_artifacts_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 2a5be50

Please sign in to comment.