From a62abac5ddfe592ca8ad9658e43981749568490e Mon Sep 17 00:00:00 2001 From: blue linden Date: Mon, 17 Nov 2025 17:11:53 -0500 Subject: [PATCH 1/5] Comment on `!build` requests with the Actions run ID for easier troubleshooting --- .github/workflows/comment-!build-commands.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/comment-!build-commands.yml b/.github/workflows/comment-!build-commands.yml index 8d8a0ae096..e6b20ed555 100644 --- a/.github/workflows/comment-!build-commands.yml +++ b/.github/workflows/comment-!build-commands.yml @@ -92,6 +92,19 @@ jobs: echo "Failed to detect if the build command written in the comment should have been '!build-dev', '!build-profiling', or '!build'" >> $GITHUB_OUTPUT fi + - name: 💬 Comment Actions run link + id: comment_actions_run_link + uses: actions/github-script@v6 + with: + script: | + return (await github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '🚧 **Building Graphite with command** `${{ steps.build_command.outputs.command }}` ...\n\nYou can monitor the progress of this build [here](https://github.com/GraphiteEditor/Graphite/actions/runs' + context.runId + ').' + })).id; + + - name: 🌐 Build Graphite web code env: NODE_ENV: production @@ -114,8 +127,8 @@ jobs: uses: actions/github-script@v6 with: script: | - github.rest.issues.createComment({ - issue_number: context.issue.number, + github.rest.issues.updateComment({ + comment_id: ${{ steps.comment_actions_run_link.outputs.result }}, owner: context.repo.owner, repo: context.repo.repo, body: '| 📦 **Build Complete for** ${{ steps.commit_info.outputs.sha }} |\n|-|\n| ${{ steps.cloudflare.outputs.url }} |' From 2afd4f156eeee718726313943f99468666b97e09 Mon Sep 17 00:00:00 2001 From: blue linden Date: Mon, 17 Nov 2025 17:36:09 -0500 Subject: [PATCH 2/5] Update the triggering comment instead of making another one for the build link --- .github/workflows/comment-!build-commands.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/comment-!build-commands.yml b/.github/workflows/comment-!build-commands.yml index e6b20ed555..379dc3bfdc 100644 --- a/.github/workflows/comment-!build-commands.yml +++ b/.github/workflows/comment-!build-commands.yml @@ -97,12 +97,12 @@ jobs: uses: actions/github-script@v6 with: script: | - return (await github.rest.issues.createComment({ - issue_number: context.issue.number, + github.rest.issues.updateComment({ + comment_id: ${{ github.event.comment.id }}, owner: context.repo.owner, repo: context.repo.repo, - body: '🚧 **Building Graphite with command** `${{ steps.build_command.outputs.command }}` ...\n\nYou can monitor the progress of this build [here](https://github.com/GraphiteEditor/Graphite/actions/runs' + context.runId + ').' - })).id; + body: '!build ([build link](https://github.com/GraphiteEditor/Graphite/actions/runs' + context.runId + '))' + }); - name: 🌐 Build Graphite web code @@ -127,8 +127,8 @@ jobs: uses: actions/github-script@v6 with: script: | - github.rest.issues.updateComment({ - comment_id: ${{ steps.comment_actions_run_link.outputs.result }}, + github.rest.issues.createComment({ + issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: '| 📦 **Build Complete for** ${{ steps.commit_info.outputs.sha }} |\n|-|\n| ${{ steps.cloudflare.outputs.url }} |' From bc59466f1311dba98af2caeb972a7e70b9a146e3 Mon Sep 17 00:00:00 2001 From: blue linden Date: Mon, 17 Nov 2025 17:42:05 -0500 Subject: [PATCH 3/5] Make sure the workflow doesn't fail if the triggering comment was deleted. --- .github/workflows/comment-!build-commands.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/comment-!build-commands.yml b/.github/workflows/comment-!build-commands.yml index 379dc3bfdc..52e4663556 100644 --- a/.github/workflows/comment-!build-commands.yml +++ b/.github/workflows/comment-!build-commands.yml @@ -101,9 +101,20 @@ jobs: comment_id: ${{ github.event.comment.id }}, owner: context.repo.owner, repo: context.repo.repo, - body: '!build ([build link](https://github.com/GraphiteEditor/Graphite/actions/runs' + context.runId + '))' + body: '!build ([build link](https://github.com/GraphiteEditor/Graphite/actions/runs/' + context.runId + '))' + }); + + - name: ❗ Post fallback comment if OG deleted + if: ${{ failure() }} + uses: actions/github-script@v6 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: 'A build was requested, [building...](https://github.com/GraphiteEditor/Graphite/actions/runs/' + context.runId + ')' }); - - name: 🌐 Build Graphite web code env: From f8c2cee94a204e5c6d01dff868a450c45db52ffa Mon Sep 17 00:00:00 2001 From: blue linden Date: Mon, 17 Nov 2025 17:45:51 -0500 Subject: [PATCH 4/5] Post comment on build/upload failure --- .github/workflows/comment-!build-commands.yml | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/comment-!build-commands.yml b/.github/workflows/comment-!build-commands.yml index 52e4663556..69103d99c7 100644 --- a/.github/workflows/comment-!build-commands.yml +++ b/.github/workflows/comment-!build-commands.yml @@ -122,6 +122,18 @@ jobs: run: | cd frontend mold -run npm run ${{ steps.build_command.outputs.command }} + + - name: ❗ Warn on build failure + if: ${{ failure() }} + uses: actions/github-script@v6 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: 'The build process has failed. Please check the [build logs](https://github.com/GraphiteEditor/Graphite/actions/runs/' + context.runId + ') for details.' + }); - name: 📤 Publish to Cloudflare Pages id: cloudflare @@ -134,6 +146,18 @@ jobs: projectName: graphite-dev directory: frontend/dist + - name: ❗ Warn on publish failure + if: ${{ failure() }} + uses: actions/github-script@v6 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: 'The deployment to Cloudflare Pages has failed. Please check the [build logs](https://github.com/GraphiteEditor/Graphite/actions/runs/' + context.runId + ') for details. + }); + - name: 💬 Comment build link uses: actions/github-script@v6 with: From 9f713d4b3db1a6d277d651ddfb151b6df568a230 Mon Sep 17 00:00:00 2001 From: blue linden Date: Mon, 17 Nov 2025 17:49:13 -0500 Subject: [PATCH 5/5] Don't post a build link comment separately if the OG is deleted --- .github/workflows/comment-!build-commands.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/comment-!build-commands.yml b/.github/workflows/comment-!build-commands.yml index 69103d99c7..883921137f 100644 --- a/.github/workflows/comment-!build-commands.yml +++ b/.github/workflows/comment-!build-commands.yml @@ -103,22 +103,11 @@ jobs: repo: context.repo.repo, body: '!build ([build link](https://github.com/GraphiteEditor/Graphite/actions/runs/' + context.runId + '))' }); - - - name: ❗ Post fallback comment if OG deleted - if: ${{ failure() }} - uses: actions/github-script@v6 - with: - script: | - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: 'A build was requested, [building...](https://github.com/GraphiteEditor/Graphite/actions/runs/' + context.runId + ')' - }); - name: 🌐 Build Graphite web code env: NODE_ENV: production + if: ${{ success() || failure()}} run: | cd frontend mold -run npm run ${{ steps.build_command.outputs.command }}