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 Mar 3, 2023
1 parent 3e1eee8 commit c42da43
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/approve-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
# 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
Expand All @@ -21,9 +23,11 @@ env:
GITHUB_TOKEN: ${{ secrets.PAT_BOT }}
jobs:
approve-pr:
if: 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 @@ -39,6 +43,8 @@ jobs:
- id: approve
name: Approve pull request
if: |
github.actor == 'unicornware' ||
steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major'
run: gh pr review ${{ github.event.number }} --approve --body 'lgtm 👍🏾'
(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.pull_request.number }} --approve --body 'lgtm 👍🏾'

0 comments on commit c42da43

Please sign in to comment.