|
10 | 10 |
|
11 | 11 | concurrency: ${{ github.workflow }}-${{ github.event.number }} |
12 | 12 |
|
13 | | -permissions: |
14 | | - contents: write |
15 | | - pull-requests: write |
| 13 | +permissions: {} |
16 | 14 |
|
17 | 15 | jobs: |
18 | 16 | generate: |
19 | 17 | if: startsWith(github.event.label.name, 'changelog:') |
20 | 18 | runs-on: ubuntu-latest |
| 19 | + environment: release |
| 20 | + permissions: {} |
21 | 21 | steps: |
22 | 22 | - name: Determine PR source |
23 | 23 | id: source |
@@ -45,13 +45,26 @@ jobs: |
45 | 45 | fi |
46 | 46 | echo "ref=$REF" >> "$GITHUB_OUTPUT" |
47 | 47 |
|
| 48 | + - name: Mint scoped app token |
| 49 | + if: steps.source.outputs.same_repo == 'true' |
| 50 | + id: app-token |
| 51 | + uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 |
| 52 | + with: |
| 53 | + app-id: ${{ secrets.RELEASE_BOT_APP_ID }} |
| 54 | + private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }} |
| 55 | + owner: tempoxyz |
| 56 | + repositories: wallet |
| 57 | + permission-contents: write |
| 58 | + permission-pull-requests: write |
| 59 | + permission-metadata: read |
| 60 | + |
48 | 61 | - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
49 | 62 | if: steps.source.outputs.same_repo == 'true' |
50 | 63 | with: |
51 | 64 | repository: ${{ github.event.pull_request.head.repo.full_name }} |
52 | 65 | ref: ${{ github.event.pull_request.head.sha }} |
53 | 66 | fetch-depth: 0 |
54 | | - token: ${{ secrets.GH_PAT }} |
| 67 | + token: ${{ steps.app-token.outputs.token }} |
55 | 68 | persist-credentials: false |
56 | 69 |
|
57 | 70 | - name: Fetch base branch for diff comparison |
|
61 | 74 | run: | |
62 | 75 | git fetch origin "$BASE_REF" |
63 | 76 |
|
64 | | - - name: Configure git credentials for private dependencies |
65 | | - if: steps.source.outputs.same_repo == 'true' |
66 | | - run: git config --global url."https://x-access-token:${{ secrets.GH_PAT }}@github.com/".insteadOf "https://github.com/" |
67 | | - |
68 | 77 | - name: Check for existing changelog |
69 | 78 | if: steps.source.outputs.same_repo == 'true' |
70 | 79 | id: existing |
@@ -140,16 +149,25 @@ jobs: |
140 | 149 | if: steps.source.outputs.same_repo == 'true' && steps.existing.outputs.found == 'false' |
141 | 150 | env: |
142 | 151 | VALIDATED_REF: ${{ steps.ref.outputs.ref }} |
| 152 | + APP_TOKEN: ${{ steps.app-token.outputs.token }} |
143 | 153 | run: | |
144 | 154 | set -euo pipefail |
145 | 155 | git config user.name "github-actions[bot]" |
146 | 156 | git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
147 | 157 | git add .changelog/ |
148 | 158 | git commit -m "chore: add changelog" |
149 | | - git push origin "HEAD:${VALIDATED_REF}" |
| 159 | + git push "https://x-access-token:${APP_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "HEAD:${VALIDATED_REF}" |
150 | 160 |
|
| 161 | + pr-feedback: |
| 162 | + name: PR feedback |
| 163 | + needs: generate |
| 164 | + if: always() && startsWith(github.event.label.name, 'changelog:') |
| 165 | + runs-on: ubuntu-latest |
| 166 | + permissions: |
| 167 | + pull-requests: write |
| 168 | + steps: |
151 | 169 | - name: Comment for fork PRs |
152 | | - if: steps.source.outputs.same_repo != 'true' |
| 170 | + if: github.event.pull_request.head.repo.full_name != github.repository |
153 | 171 | env: |
154 | 172 | GH_TOKEN: ${{ github.token }} |
155 | 173 | PR_NUMBER: ${{ github.event.number }} |
|
0 commit comments