Improve bug reports #2190
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto approve PRs by bots | |
on: | |
# Trigger when any action on a pull request is taken. | |
pull_request_target: | |
jobs: | |
approve: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write # Allows approving the PR. | |
contents: write # Allows merging the PR. | |
# Only run if one of the defined bots is the pull request author. | |
# https://github.com/City-of-Helsinki/tilavarauspalvelu-core/settings/variables/actions | |
if: contains(fromJSON(vars.BOTS), github.event.pull_request.user.login) | |
steps: | |
- name: "Check out repository" | |
uses: actions/checkout@v4 | |
- name: "Approve a pull request and set to auto rebase-merge if tests pass" | |
# Only approve the PR if it's not already approved to avoid email spam. | |
run: | | |
gh pr checkout "$PR_URL" | |
if [ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ]; | |
then gh pr review --approve "$PR_URL" | |
else echo "PR already approved."; | |
fi | |
gh pr merge --auto --rebase "$PR_URL" | |
env: | |
PR_URL: ${{ github.event.pull_request.html_url }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |