Skip to content

Commit

Permalink
ci(workflows): [approve-pr] refactor approval step conditional
Browse files Browse the repository at this point in the history
Signed-off-by: Lexus Drumgold <[email protected]>
  • Loading branch information
unicornware committed Jan 31, 2023
1 parent 963fc36 commit c7da441
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/approve-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,27 @@
# References:
#
# - https://cli.github.com/manual/gh_pr_review
# - https://docs.github.com/actions/learn-github-actions/expressions
# - https://docs.github.com/actions/using-workflows/events-that-trigger-workflows#pull_request
# - https://github.com/actions/checkout
# - https://github.com/dependabot/fetch-metadata
# - https://github.com/hmarr/debug-action

---
name: approve-pr
on:
pull_request:
types:
- review_requested
- synchronize
env:
GITHUB_TOKEN: ${{ secrets.PAT_BOT }}
jobs:
approve-pr:
if: |
github.event_name == 'synchronize' ||
github.event.requested_reviewer.login == 'flexdevelopment'
runs-on: ubuntu-latest
steps:
- id: debug
name: Print environment variables and event payload
uses: hmarr/[email protected]
- id: dependabot-metadata
name: Fetch dependabot metadata
if: github.actor == 'dependabot[bot]'
Expand All @@ -42,6 +43,8 @@ jobs:
- id: approve
name: Approve pull request
if: |
github.actor == 'unicornware' ||
steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major'
(github.event.requested_reviewer.login == 'flexdevelopment'
|| contains(join(github.event.requested_reviewers.*.login, ','), 'flexdevelopment'))
&& (github.actor == 'dependabot[bot]' || github.actor == 'unicornware')
&& steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major'
run: gh pr review ${{ github.event.number }} --approve --body 'lgtm 👍🏾'

0 comments on commit c7da441

Please sign in to comment.