Skip to content

Commit a6ad5a3

Browse files
committed
Test classref PR autoclose
1 parent b59b12f commit a6ad5a3

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

.github/workflows/autoclose.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Close pull requests that modify automatically generated files
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
7+
jobs:
8+
autoclose:
9+
runs-on: ubuntu-20.04
10+
steps:
11+
- uses: actions/checkout@v2
12+
13+
- name: Autoclose
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16+
PULL_REQUEST_FILES: ${{ github.event.pull_request.files }}
17+
run: |
18+
echo "PULL_REQUEST_FILES:"
19+
echo "$PULL_REQUEST_FILES"
20+
echo ""
21+
echo "${{ github.event.pull_request.files }}"
22+
23+
pull_request_valid=0
24+
25+
if [[ $pull_request_valid == 1 ]]; then
26+
echo "Success: The pull request does not modify class reference files."
27+
else
28+
echo "ERROR: The pull request modifies automatically generated class reference files in the _classes/ folder. It will be automatically closed."
29+
if [ ${{ github.event.action }} = opened ]; then
30+
issue_close_body=$'Thanks for opening a pull request\!\n\n'
31+
issue_close_body+="Contributions to the class reference should be sent on the main Godot repository, not here. This is because the class reference in this repository is generated automatically based on the XML files in the main repository. See [Contribute to the class reference](https://docs.godotengine.org/en/latest/community/contributing/updating_the_class_reference.html) in the documentation for instructions :slightly_smiling_face:"
32+
33+
gh issue comment ${{ github.event.pull_request.number }} -b "$issue_close_body"
34+
gh issue close ${{ github.event.pull_request.number }}
35+
gh issue edit ${{ github.event.pull_request.number }} --add-label "archived"
36+
fi
37+
fi

0 commit comments

Comments
 (0)