Skip to content
This repository was archived by the owner on Aug 25, 2024. It is now read-only.

Commit 52cdc71

Browse files
author
John Andersen
authored
ci: pr auto approve: Validate event sender
1 parent bea4865 commit 52cdc71

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

.github/workflows/00_pr_auto_approve.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,8 @@ jobs:
3535
runs-on: ubuntu-latest
3636
permissions:
3737
pull-requests: write
38-
# if: ${{ github.event_name == 'repository_dispatch' && contains(fromJson('["dependabot[bot]", "github-actions[bot]", "pdxjohnny"]'), github.event.actor) }}
39-
if: github.event_name != 'pull_request_review'
38+
if: ${{ github.event_name == 'repository_dispatch' && contains(fromJson('["github-actions[bot]", "pdxjohnny"]'), github.event.sender.login) && contains(fromJson('["dependabot[bot]", "github-actions[bot]", "pdxjohnny"]'), github.event.client_payload.actor) }}
4039
steps:
41-
- shell: cat -v {0}
42-
run: ${{ toJSON(github.event) }}
43-
4440
- name: Harden Runner
4541
uses: step-security/harden-runner@17d0e2bd7d51742c71671bd19fa12bdc9d40a3d6 # v2.8.1
4642
with:
@@ -49,11 +45,11 @@ jobs:
4945
- uses: hmarr/auto-approve-action@8f929096a962e83ccdfa8afcf855f39f12d4dac7 # v4
5046
with:
5147
review-message: "LGTM"
52-
pull-request-number: ${{ github.event.pull_request.number }}
48+
pull-request-number: ${{ github.event.client_payload.pull_request.number }}
5349

5450
- env:
5551
GH_TOKEN: ${{ github.token }}
56-
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
52+
PULL_REQUEST_NUMBER: ${{ github.event.client_payload.pull_request.number }}
5753
run: |
5854
set -x
5955
gh pr merge --rebase "${PULL_REQUEST_NUMBER}"

0 commit comments

Comments
 (0)