|
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.0.0 |
| 8 | +# Version: v4.2.0 |
9 | 9 | ################################### |
10 | 10 | name: Cleanup |
11 | 11 |
|
| 12 | +#gt-placeholder-trigger-start |
12 | 13 | on: |
13 | 14 | push: |
14 | 15 | branches: |
15 | 16 | - main |
| 17 | +#gt-placeholder-trigger-end |
16 | 18 |
|
| 19 | +#gt-placeholder-permissions-start |
17 | 20 | permissions: |
18 | 21 | contents: read |
| 22 | +#gt-placeholder-permissions-end |
19 | 23 |
|
20 | 24 | jobs: |
21 | 25 | build: |
| 26 | + #gt-placeholder-runs-on-start |
22 | 27 | runs-on: ubuntu-latest |
| 28 | + #gt-placeholder-runs-on-end |
23 | 29 | steps: |
24 | 30 | - uses: actions/checkout@v5 |
| 31 | + |
| 32 | + #gt-placeholder-install-dependencies-start |
| 33 | + #gt-placeholder-install-dependencies-end |
25 | 34 | # start inserted via pull-hook.sh - modify there |
26 | 35 | - name: Setup JDK 17 |
27 | 36 | uses: actions/setup-java@v5 |
|
31 | 40 | cache: sbt |
32 | 41 | - uses: sbt/setup-sbt@v1 |
33 | 42 | # end inserted via pull-hook.sh - modify there |
| 43 | + |
34 | 44 | - name: Cleanup Sources |
35 | 45 | run: ./scripts/cleanup-on-push-to-main.sh |
| 46 | + |
| 47 | + - name: Check if actor is collaborator |
| 48 | + id: check-collaborator |
| 49 | + run: | |
| 50 | + user="${{ github.actor }}" |
| 51 | + repo="${{ github.repository }}" |
| 52 | + status=$(curl -s -o /dev/null -w '%{http_code}' \ |
| 53 | + -H "Authorization: Bearer $GITHUB_TOKEN" \ |
| 54 | + -H "Accept: application/vnd.github+json" \ |
| 55 | + "https://api.github.com/repos/$repo/collaborators/$user") |
| 56 | + echo "status $status for user $user" |
| 57 | + if [ "$status" = "204" ]; then |
| 58 | + echo "reviewer=$user" >> $GITHUB_OUTPUT |
| 59 | + else |
| 60 | + echo "reviewer=" >> $GITHUB_OUTPUT |
| 61 | + fi |
| 62 | + env: |
| 63 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + |
36 | 65 | - name: Create Pull Request if necessary |
37 | 66 | uses: peter-evans/create-pull-request@v7 |
38 | 67 | with: |
|
43 | 72 | delete-branch: true |
44 | 73 | token: ${{ secrets.AUTO_PR_TOKEN }} |
45 | 74 | push-to-fork: ${{ vars.AUTO_PR_FORK_NAME != '' && vars.AUTO_PR_FORK_NAME || secrets.AUTO_PR_FORK_NAME }} |
| 75 | + reviewers: ${{ steps.check-collaborator.outputs.reviewer }} |
0 commit comments