Skip to content

Commit 024b536

Browse files
committed
fix(pr-trigger): refine conditions for triggering builds and improve comments for forked PRs
1 parent 7574fcb commit 024b536

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

.github/workflows/pr-trigger.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66

77
jobs:
88
trigger-build:
9-
if: github.event.issue.pull_request
9+
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '.build')
1010
runs-on: ubuntu-slim
1111
permissions:
1212
actions: write
@@ -44,21 +44,21 @@ jobs:
4444
if: steps.command.outputs.continue == 'true' && steps.get-branch.outputs.same_repo == 'true'
4545
env:
4646
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
BRANCH: ${{ steps.get-branch.outputs.branch }}
4748
run: |
48-
gh workflow run build-dmg.yml --ref ${{ steps.get-branch.outputs.branch }} -R ${{ github.repository }}
49-
49+
gh workflow run build-dmg.yml --ref "$BRANCH" -R "${{ github.repository }}"
5050
- name: Comment on PR
5151
if: steps.command.outputs.continue == 'true' && steps.get-branch.outputs.same_repo == 'true'
5252
env:
5353
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5454
run: |
5555
PR_NUMBER="${{ github.event.issue.number }}"
56-
gh pr comment $PR_NUMBER --body "Build triggered for branch `${{ steps.get-branch.outputs.branch }}`. Check the Actions tab for progress." -R ${{ github.repository }}
56+
gh pr comment "$PR_NUMBER" --body "Build triggered for branch \`${{ steps.get-branch.outputs.branch }}\`. Check the Actions tab for progress." -R "${{ github.repository }}"
5757
5858
- name: Comment on PR for fork
59-
if: steps.command.outputs.continue == 'true' && steps.get-branch.outputs.same_repo != 'true'
59+
if: steps.command.outputs.continue == 'true' && steps.get-branch.outputs.same_repo == 'false'
6060
env:
6161
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6262
run: |
6363
PR_NUMBER="${{ github.event.issue.number }}"
64-
gh pr comment $PR_NUMBER --body "Build was not triggered automatically because this pull request comes from a fork, and branch `${{ steps.get-branch.outputs.branch }}` does not exist in `${{ github.repository }}`." -R ${{ github.repository }}
64+
gh pr comment "$PR_NUMBER" --body "Build was not triggered automatically because this pull request comes from a fork. A maintainer can trigger it manually by running the \`build-dmg\` workflow against branch \`${{ steps.get-branch.outputs.branch }}\`." -R "${{ github.repository }}"

0 commit comments

Comments
 (0)