Skip to content

Automatic PR: Merging dev into main (9301793) #136

Automatic PR: Merging dev into main (9301793)

Automatic PR: Merging dev into main (9301793) #136

Workflow file for this run

name: Pull Request Filter
on: pull_request_target
jobs:
filter:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Label pull request
uses: actions/labeler@v4
- name: Close pull requests that directly commit to main
run: |
comment="
You cannot directly commit to the [\`main\`](https://github.com/Atlas) branch, read the contribution guide and only commit to [\`dev\`](https://github.com/Atlas/tree/dev).
**Contribution Guidelines:** https://docs.atlasos.net/contributions
"
exclude_labels="
bypass
auto-pr
translations
readme
"
no_run=false
for pr_number in $(gh pr list --json number --jq '.[].number'); do
echo "Processing pull request: #$pr_number"
for label in $(gh pr view $pr_number --json labels --jq '.labels[].name'); do
if [[ "$exclude_labels" == *"$label"* ]]; then
no_run=true
break
fi
done
if [ "$no_run" == "true" ]; then
echo "Pull request #$pr_number merges into main, but it is being bypassed due to its labels."
else
if [ $(gh pr view $pr_number --json baseRefName --jq '.baseRefName') == 'main' ]; then
echo "Closing pull request #$pr_number as it directly commits to main..."
gh pr close $pr_number --comment "$comment"
fi
fi
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}