|
6 | 6 | - cron: "0 8 * * *" |
7 | 7 | workflow_dispatch: |
8 | 8 |
|
9 | | -permissions: |
10 | | - contents: write |
11 | | - pull-requests: write |
12 | | - |
13 | 9 | jobs: |
14 | 10 | update-ubuntu-iso: |
15 | 11 | name: Check for Ubuntu ISO updates |
16 | 12 | runs-on: ubuntu-latest |
17 | 13 | steps: |
| 14 | + - uses: actions/create-github-app-token@v1 |
| 15 | + id: app-token |
| 16 | + with: |
| 17 | + app-id: ${{ vars.TROPI_APP_ID }} |
| 18 | + private-key: ${{ secrets.TROPI_APP_PRIVATE_KEY }} |
| 19 | + |
18 | 20 | - name: Checkout Code |
19 | 21 | uses: actions/checkout@v6 |
20 | 22 |
|
@@ -59,10 +61,21 @@ jobs: |
59 | 61 | echo "current_iso=$CURRENT_ISO" >> "$GITHUB_OUTPUT" |
60 | 62 | echo "latest_iso=$LATEST_ISO" >> "$GITHUB_OUTPUT" |
61 | 63 |
|
| 64 | + - name: Close outdated Ubuntu ISO PR |
| 65 | + if: steps.ubuntu.outputs.updated == 'true' |
| 66 | + env: |
| 67 | + GH_TOKEN: ${{ steps.app-token.outputs.token }} |
| 68 | + run: | |
| 69 | + EXISTING_PR=$(gh pr list --head auto/update-ubuntu-iso --state open --json number --jq '.[0].number') |
| 70 | + if [ -n "$EXISTING_PR" ]; then |
| 71 | + gh pr close "$EXISTING_PR" --comment "Superseded by a newer Ubuntu ISO version (${{ steps.ubuntu.outputs.latest_iso }})." --delete-branch |
| 72 | + fi |
| 73 | +
|
62 | 74 | - name: Create Pull Request for Ubuntu ISO update |
63 | 75 | if: steps.ubuntu.outputs.updated == 'true' |
64 | 76 | uses: peter-evans/create-pull-request@v7 |
65 | 77 | with: |
| 78 | + token: ${{ steps.app-token.outputs.token }} |
66 | 79 | commit-message: "Update Ubuntu base ISO to ${{ steps.ubuntu.outputs.latest_iso }}" |
67 | 80 | branch: auto/update-ubuntu-iso |
68 | 81 | delete-branch: true |
|
80 | 93 | name: Check for Debian ISO updates |
81 | 94 | runs-on: ubuntu-latest |
82 | 95 | steps: |
| 96 | + - uses: actions/create-github-app-token@v1 |
| 97 | + id: app-token |
| 98 | + with: |
| 99 | + app-id: ${{ vars.TROPI_APP_ID }} |
| 100 | + private-key: ${{ secrets.TROPI_APP_PRIVATE_KEY }} |
| 101 | + |
83 | 102 | - name: Checkout Code |
84 | 103 | uses: actions/checkout@v6 |
85 | 104 |
|
@@ -139,10 +158,21 @@ jobs: |
139 | 158 | echo "current_iso=$CURRENT_ISO" >> "$GITHUB_OUTPUT" |
140 | 159 | echo "latest_iso=$LATEST_ISO" >> "$GITHUB_OUTPUT" |
141 | 160 |
|
| 161 | + - name: Close outdated Debian ISO PR |
| 162 | + if: steps.debian.outputs.updated == 'true' |
| 163 | + env: |
| 164 | + GH_TOKEN: ${{ steps.app-token.outputs.token }} |
| 165 | + run: | |
| 166 | + EXISTING_PR=$(gh pr list --head auto/update-debian-iso --state open --json number --jq '.[0].number') |
| 167 | + if [ -n "$EXISTING_PR" ]; then |
| 168 | + gh pr close "$EXISTING_PR" --comment "Superseded by a newer Debian ISO version (${{ steps.debian.outputs.latest_iso }})." --delete-branch |
| 169 | + fi |
| 170 | +
|
142 | 171 | - name: Create Pull Request for Debian ISO update |
143 | 172 | if: steps.debian.outputs.updated == 'true' |
144 | 173 | uses: peter-evans/create-pull-request@v7 |
145 | 174 | with: |
| 175 | + token: ${{ steps.app-token.outputs.token }} |
146 | 176 | commit-message: "Update Debian base ISO to ${{ steps.debian.outputs.latest_iso }}" |
147 | 177 | branch: auto/update-debian-iso |
148 | 178 | delete-branch: true |
|
0 commit comments