Update PR-Demo-Comment-with-react.yml (#3328)

# Description of Changes

Please provide a summary of the changes, including:

- What was changed
- Why the change was made
- Any challenges encountered

Closes #(issue_number)

---

## Checklist

### General

- [ ] I have read the [Contribution
Guidelines](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/CONTRIBUTING.md)
- [ ] I have read the [Stirling-PDF Developer
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md)
(if applicable)
- [ ] I have read the [How to add new languages to
Stirling-PDF](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md)
(if applicable)
- [ ] I have performed a self-review of my own code
- [ ] My changes generate no new warnings

### Documentation

- [ ] I have updated relevant docs on [Stirling-PDF's doc
repo](https://github.com/Stirling-Tools/Stirling-Tools.github.io/blob/main/docs/)
(if functionality has heavily changed)
- [ ] I have read the section [Add New Translation
Tags](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/HowToAddNewLanguage.md#add-new-translation-tags)
(for new translation tags only)

### UI Changes (if applicable)

- [ ] Screenshots or videos demonstrating the UI changes are attached
(e.g., as comments or direct attachments in the PR)

### Testing (if applicable)

- [ ] I have tested my changes locally. Refer to the [Testing
Guide](https://github.com/Stirling-Tools/Stirling-PDF/blob/main/DeveloperGuide.md#6-testing)
for more details.
This commit is contained in:
Anthony Stirling 2025-04-10 11:16:50 +01:00 committed by GitHub
parent 3365ea4c91
commit 6ae9484e5b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -6,13 +6,12 @@ on:
permissions: permissions:
contents: read contents: read
issues: write # Required for adding reactions to comments
pull-requests: read # Required for reading PR information
jobs: jobs:
check-comment: check-comment:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions:
pull-requests: read
issues: read
if: | if: |
github.event.issue.pull_request && github.event.issue.pull_request &&
( (
@ -75,24 +74,31 @@ jobs:
core.setOutput('ref', pr.head.ref); core.setOutput('ref', pr.head.ref);
- name: Add 'in_progress' reaction to comment - name: Add 'in_progress' reaction to comment
id: add-eyes-reaction
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with: with:
script: | script: |
const { owner, repo } = context.repo; console.log(`Adding eyes reaction to comment ID: ${context.payload.comment.id}`);
const commentId = context.payload.comment.id; try {
const { data: reaction } = await github.rest.reactions.createForIssueComment({
await github.rest.reactions.createForIssueComment({ owner: context.repo.owner,
owner, repo: context.repo.repo,
repo, comment_id: context.payload.comment.id,
comment_id: commentId, content: 'eyes'
content: 'eyes' });
}); console.log(`Added reaction with ID: ${reaction.id}`);
return { success: true, id: reaction.id };
} catch (error) {
console.error(`Failed to add reaction: ${error.message}`);
console.error(error);
return { success: false, error: error.message };
}
deploy-pr: deploy-pr:
needs: check-comment needs: check-comment
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
pull-requests: write contents: read
issues: write issues: write
steps: steps:
@ -201,30 +207,38 @@ jobs:
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with: with:
script: | script: |
const { owner, repo } = context.repo; console.log(`Adding rocket reaction to comment ID: ${{ needs.check-comment.outputs.comment_id }}`);
const commentId = ${{ needs.check-comment.outputs.comment_id }}; try {
const { data: reaction } = await github.rest.reactions.createForIssueComment({
await github.rest.reactions.createForIssueComment({ owner: context.repo.owner,
owner, repo: context.repo.repo,
repo, comment_id: ${{ needs.check-comment.outputs.comment_id }},
comment_id: commentId, content: 'rocket'
content: 'rocket' });
}); console.log(`Added rocket reaction with ID: ${reaction.id}`);
} catch (error) {
console.error(`Failed to add reaction: ${error.message}`);
console.error(error);
}
- name: Add failure reaction to comment - name: Add failure reaction to comment
if: failure() if: failure()
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with: with:
script: | script: |
const { owner, repo } = context.repo; console.log(`Adding -1 reaction to comment ID: ${{ needs.check-comment.outputs.comment_id }}`);
const commentId = ${{ needs.check-comment.outputs.comment_id }}; try {
const { data: reaction } = await github.rest.reactions.createForIssueComment({
await github.rest.reactions.createForIssueComment({ owner: context.repo.owner,
owner, repo: context.repo.repo,
repo, comment_id: ${{ needs.check-comment.outputs.comment_id }},
comment_id: commentId, content: '-1'
content: '-1' });
}); console.log(`Added -1 reaction with ID: ${reaction.id}`);
} catch (error) {
console.error(`Failed to add reaction: ${error.message}`);
console.error(error);
}
- name: Post deployment URL to PR - name: Post deployment URL to PR
if: success() if: success()