Skip to content
37 changes: 37 additions & 0 deletions .github/workflows/comment-!build-commands.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,37 @@ 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: |
github.rest.issues.updateComment({
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 + '))'
});

- name: 🌐 Build Graphite web code
env:
NODE_ENV: production
if: ${{ success() || failure()}}
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
Expand All @@ -110,6 +135,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:
Expand Down
Loading