Files
flathub/.github/workflows/close-master-prs.yml
T
2025-03-30 09:00:53 +05:30

40 lines
1.6 KiB
YAML

name: Close PRs to master
# WARNING: Do NOT use org level secrets or checkout any code in this
# workflow
on:
pull_request_target:
types: [opened]
branches:
- master
workflow_dispatch:
jobs:
close:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Check and close
run: |
has_label=$(gh pr view "$PR_NUM" --json labels -q '.labels | any(.name == "leave-open" or .name == "dependencies")')
if [[ "$has_label" != "true" ]]; then
echo "Not labeled 'leave-open' or 'dependencies'. Closing."
gh pr close "$PR_NUM" -c "$COMMENT"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
PR_NUM: ${{ github.event.pull_request.number }}
COMMENT: >
This PR is automatically closed because application
submission pull requests must be made against the new-pr
branch. Please choose the base repository as
"flathub/flathub" and the base as "new-pr" in the
"Comparing changes" screen when making the pull request.
The image below shows this. If this was closed in
error, please comment.
![Image showing new-pr target branch in light mode](https://raw.githubusercontent.com/flathub/flathub/refs/heads/master/.github/images/pr_image_light.png#gh-light-mode-only)
![Image showing new-pr target branch in dark mode](https://raw.githubusercontent.com/flathub/flathub/refs/heads/master/.github/images/pr_image_dark.png#gh-dark-mode-only)