Skip to content

Commit ed7875d

Browse files
committed
Update GitHub Actions PR validation logic
Switch `release-labels` job trigger to `pull_request_target` and refine `dependabot` automerge conditions by verifying `actor_id`. Enhance logging for approval and merge steps to provide better visibility.
1 parent 2305d58 commit ed7875d

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

.github/workflows/contrib.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
release-labels:
4848
runs-on: ubuntu-latest
4949
# Skip tagging for draft PRs.
50-
if: ${{ github.event_name == 'pull_request' && !github.event.pull_request.draft }}
50+
if: ${{ github.event_name == 'pull_request_target' && !github.event.pull_request.draft }}
5151
steps:
5252
- name: release-labels
5353
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1

.github/workflows/dependabot.yaml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
# Dependabot is annoying, but this makes it a bit less so.
1919
dependabot-automerge:
2020
runs-on: ubuntu-latest
21-
if: github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'coder/coder'
21+
if: github.event_name == 'pull_request' && github.event.pull_request.user.login == 'dependabot[bot]' && github.actor_id == 49699333 && github.repository == 'coder/coder'
2222
permissions:
2323
pull-requests: write
2424
contents: write
@@ -30,21 +30,25 @@ jobs:
3030
github-token: "${{ secrets.GITHUB_TOKEN }}"
3131

3232
- name: Approve the PR
33-
run: gh pr review --approve "$PR_URL"
33+
run: |
34+
echo "Approving $PR_URL"
35+
gh pr review --approve "$PR_URL"
3436
env:
3537
PR_URL: ${{github.event.pull_request.html_url}}
3638
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
3739

3840
- name: Enable auto-merge
39-
run: gh pr merge --auto --squash "$PR_URL"
41+
run: |
42+
echo "Enabling auto-merge for $PR_URL"
43+
gh pr merge --auto --squash "$PR_URL"
4044
env:
4145
PR_URL: ${{github.event.pull_request.html_url}}
4246
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
4347

4448
dependabot-automerge-notify:
4549
# Send a slack notification when a dependabot PR is merged.
4650
runs-on: ubuntu-latest
47-
if: github.event_name == 'push' && github.actor == 'github-actions[bot]'
51+
if: github.event_name == 'push' && github.actor == 'github-actions[bot]' && github.actor_id == 41898282 && github.repository == 'coder/coder'
4852
steps:
4953
- name: Send Slack notification
5054
env:

0 commit comments

Comments
 (0)