Skip to content

Commit f13faa4

Browse files
committed
ci(workflows): [approve-pr] refactor approval step conditional
Signed-off-by: Lexus Drumgold <[email protected]>
1 parent bd26e5d commit f13faa4

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

.github/workflows/approve-pr.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
# References:
88
#
99
# - https://cli.github.com/manual/gh_pr_review
10+
# - https://docs.github.com/actions/learn-github-actions/expressions
1011
# - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#pull_request
1112
# - https://github.com/actions/checkout
1213
# - https://github.com/dependabot/fetch-metadata
14+
# - https://github.com/hmarr/debug-action
1315

1416
---
1517
name: approve-pr
@@ -21,9 +23,11 @@ env:
2123
GITHUB_TOKEN: ${{ secrets.PAT_BOT }}
2224
jobs:
2325
approve-pr:
24-
if: github.event.requested_reviewer.login == 'flexdevelopment'
2526
runs-on: ubuntu-latest
2627
steps:
28+
- id: debug
29+
name: Print environment variables and event payload
30+
uses: hmarr/[email protected]
2731
- id: dependabot-metadata
2832
name: Fetch dependabot metadata
2933
if: github.actor == 'dependabot[bot]'
@@ -39,6 +43,8 @@ jobs:
3943
- id: approve
4044
name: Approve pull request
4145
if: |
42-
github.actor == 'unicornware' ||
43-
steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major'
46+
(github.event.requested_reviewer.login == 'flexdevelopment'
47+
|| contains(join(github.event.requested_reviewers.*.login, ','), 'flexdevelopment'))
48+
&& (github.actor == 'dependabot[bot]' || github.actor == 'unicornware')
49+
&& steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major'
4450
run: gh pr review ${{ github.event.number }} --approve --body 'lgtm 👍🏾'

0 commit comments

Comments
 (0)