|
5 | 5 | # \__/\__/\_, /\___/_//_/\_,_/_/ It is licensed under Creative Commons Zero v1.0 Universal |
6 | 6 | # /___/ Please report bugs and contribute back your improvements |
7 | 7 | # |
8 | | -# Version: v4.1.0 |
| 8 | +# Version: v4.2.0 |
9 | 9 | ################################### |
10 | 10 | name: Cleanup |
11 | 11 |
|
12 | | -on: |
13 | | - push: |
14 | | - branches: |
15 | | - - main |
| 12 | +#gt-placeholder-trigger-start |
| 13 | +#gt-placeholder-trigger-start |
| 14 | +#gt-placeholder-trigger-start |
| 15 | +#gt-placeholder-trigger-start |
| 16 | +#gt-placeholder-trigger-start |
16 | 17 |
|
17 | | -permissions: |
18 | | - contents: read |
| 18 | +#gt-placeholder-permissions-start |
| 19 | +#gt-placeholder-permissions-start |
| 20 | +#gt-placeholder-permissions-start |
19 | 21 |
|
20 | 22 | jobs: |
21 | 23 | build: |
22 | | - runs-on: ubuntu-latest |
| 24 | + #gt-placeholder-runs-on-start |
| 25 | + #gt-placeholder-runs-on-start |
23 | 26 | steps: |
24 | 27 | - uses: actions/checkout@v5 |
25 | 28 |
|
|
32 | 35 | run: ./scripts/cleanup-on-push-to-main.sh |
33 | 36 |
|
34 | 37 | - name: Check if actor is collaborator |
35 | | - id: check-collab |
| 38 | + id: check-collaborator |
36 | 39 | run: | |
37 | 40 | user="${{ github.actor }}" |
38 | 41 | repo="${{ github.repository }}" |
|
59 | 62 | delete-branch: true |
60 | 63 | token: ${{ secrets.AUTO_PR_TOKEN }} |
61 | 64 | push-to-fork: ${{ vars.AUTO_PR_FORK_NAME != '' && vars.AUTO_PR_FORK_NAME || secrets.AUTO_PR_FORK_NAME }} |
62 | | - reviewers: ${{ steps.check-collab.outputs.reviewer }} |
| 65 | + reviewers: ${{ steps.check-collaborator.outputs.reviewer }} |
| 66 | + |
| 67 | +#gt-placeholder-permissions-start |
| 68 | +#gt-placeholder-permissions-start |
| 69 | +#gt-placeholder-permissions-start |
| 70 | + |
| 71 | +jobs: |
| 72 | + build: |
| 73 | + #gt-placeholder-runs-on-start |
| 74 | + #gt-placeholder-runs-on-start |
| 75 | + steps: |
| 76 | + - uses: actions/checkout@v5 |
| 77 | + |
| 78 | + #gt-placeholder-install-dependencies-start |
| 79 | + |
| 80 | + - name: Cleanup Sources |
| 81 | + run: ./scripts/cleanup-on-push-to-main.sh |
| 82 | + |
| 83 | + - name: Check if actor is collaborator |
| 84 | + id: check-collaborator |
| 85 | + run: | |
| 86 | + user="${{ github.actor }}" |
| 87 | + repo="${{ github.repository }}" |
| 88 | + status=$(curl -s -o /dev/null -w '%{http_code}' \ |
| 89 | + -H "Authorization: Bearer $GITHUB_TOKEN" \ |
| 90 | + -H "Accept: application/vnd.github+json" \ |
| 91 | + "https://api.github.com/repos/$repo/collaborators/$user") |
| 92 | + echo "status $status for user $user" |
| 93 | + if [ "$status" = "204" ]; then |
| 94 | + echo "reviewer=$user" >> $GITHUB_OUTPUT |
| 95 | + else |
| 96 | + echo "reviewer=" >> $GITHUB_OUTPUT |
| 97 | + fi |
| 98 | + env: |
| 99 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 100 | + |
| 101 | + - name: Create Pull Request if necessary |
| 102 | + uses: peter-evans/create-pull-request@v7 |
| 103 | + with: |
| 104 | + branch: auto-cleanup |
| 105 | + title: Auto Cleanup |
| 106 | + commit-message: auto cleanup sources |
| 107 | + body: Looks like someone forgot to run ./scripts/cleanup-on-push-to-main.sh before committing. I did it for them :) |
| 108 | + delete-branch: true |
| 109 | + token: ${{ secrets.AUTO_PR_TOKEN }} |
| 110 | + push-to-fork: ${{ vars.AUTO_PR_FORK_NAME != '' && vars.AUTO_PR_FORK_NAME || secrets.AUTO_PR_FORK_NAME }} |
| 111 | + reviewers: ${{ steps.check-collaborator.outputs.reviewer }} |
0 commit comments