mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-09-12 17:52:13 +02:00
Update PR-Demo-Comment.yml
This commit is contained in:
parent
3b57489e38
commit
27f172e819
64
.github/workflows/PR-Demo-Comment.yml
vendored
64
.github/workflows/PR-Demo-Comment.yml
vendored
@ -12,8 +12,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
issues: write
|
||||
contents: read
|
||||
issues: read
|
||||
if: |
|
||||
github.event.issue.pull_request &&
|
||||
(
|
||||
@ -35,7 +34,7 @@ jobs:
|
||||
pr_number: ${{ steps.get-pr.outputs.pr_number }}
|
||||
pr_repository: ${{ steps.get-pr-info.outputs.repository }}
|
||||
pr_ref: ${{ steps.get-pr-info.outputs.ref }}
|
||||
comment_id: ${{ steps.get-comment-id.outputs.comment_id }}
|
||||
comment_id: ${{ github.event.comment.id }}
|
||||
|
||||
steps:
|
||||
- name: Harden Runner
|
||||
@ -43,29 +42,6 @@ jobs:
|
||||
with:
|
||||
egress-policy: audit
|
||||
|
||||
- name: Get Comment ID
|
||||
id: get-comment-id
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
script: |
|
||||
const commentId = context.payload.comment.id;
|
||||
console.log(`Comment ID: ${commentId}`);
|
||||
core.setOutput('comment_id', commentId);
|
||||
|
||||
- name: Add "in progress" reaction to comment
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
script: |
|
||||
const commentId = context.payload.comment.id;
|
||||
// Add eyes reaction (looking/in progress)
|
||||
await github.rest.reactions.createForIssueComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
comment_id: commentId,
|
||||
content: 'eyes'
|
||||
});
|
||||
console.log('Added "in progress" reaction');
|
||||
|
||||
- name: Get PR data
|
||||
id: get-pr
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
@ -98,6 +74,20 @@ jobs:
|
||||
core.setOutput('repository', repository);
|
||||
core.setOutput('ref', pr.head.ref);
|
||||
|
||||
- name: Add 'in_progress' reaction to comment
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
script: |
|
||||
const { owner, repo } = context.repo;
|
||||
const commentId = context.payload.comment.id;
|
||||
|
||||
await github.rest.reactions.createForIssueComment({
|
||||
owner,
|
||||
repo,
|
||||
comment_id: commentId,
|
||||
content: 'eyes'
|
||||
});
|
||||
|
||||
deploy-pr:
|
||||
needs: check-comment
|
||||
runs-on: ubuntu-latest
|
||||
@ -162,6 +152,7 @@ jobs:
|
||||
sudo chmod 600 ../private.key
|
||||
|
||||
- name: Deploy to VPS
|
||||
id: deploy
|
||||
run: |
|
||||
# First create the docker-compose content locally
|
||||
cat > docker-compose.yml << 'EOF'
|
||||
@ -205,36 +196,35 @@ jobs:
|
||||
docker-compose up -d
|
||||
ENDSSH
|
||||
|
||||
- name: Add success reaction to comment if deployment succeeded
|
||||
- name: Add success reaction to comment
|
||||
if: success()
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
script: |
|
||||
const { owner, repo } = context.repo;
|
||||
const commentId = ${{ needs.check-comment.outputs.comment_id }};
|
||||
|
||||
// Add rocket reaction (success)
|
||||
await github.rest.reactions.createForIssueComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
owner,
|
||||
repo,
|
||||
comment_id: commentId,
|
||||
content: 'rocket'
|
||||
});
|
||||
console.log('Added success reaction');
|
||||
|
||||
- name: Add failure reaction to comment if any step failed
|
||||
- name: Add failure reaction to comment
|
||||
if: failure()
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
||||
with:
|
||||
script: |
|
||||
const { owner, repo } = context.repo;
|
||||
const commentId = ${{ needs.check-comment.outputs.comment_id }};
|
||||
|
||||
// Add -1 reaction (failure)
|
||||
await github.rest.reactions.createForIssueComment({
|
||||
owner: context.repo.owner,
|
||||
repo: context.repo.repo,
|
||||
owner,
|
||||
repo,
|
||||
comment_id: commentId,
|
||||
content: 'confused'
|
||||
console.log('Added failure reaction');
|
||||
content: '-1'
|
||||
});
|
||||
|
||||
- name: Post deployment URL to PR
|
||||
if: success()
|
||||
|
Loading…
Reference in New Issue
Block a user