|
5 | 5 | schedule: |
6 | 6 | - cron: "0 0 * * *" |
7 | 7 | jobs: |
8 | | - createPullRequest: |
| 8 | + update-flake-lock: |
9 | 9 | runs-on: ubuntu-latest |
10 | 10 | steps: |
| 11 | + - name: Create GitHub App token |
| 12 | + uses: actions/create-github-app-token@v2 |
| 13 | + if: vars.CI_APP_ID |
| 14 | + id: app-token |
| 15 | + with: |
| 16 | + app-id: ${{ vars.CI_APP_ID }} |
| 17 | + private-key: ${{ secrets.CI_APP_PRIVATE_KEY }} |
| 18 | + permission-contents: write |
| 19 | + permission-pull-requests: write |
| 20 | + permission-issues: write |
| 21 | + - name: Get GitHub App user info |
| 22 | + id: user-info |
| 23 | + if: vars.CI_APP_ID |
| 24 | + env: |
| 25 | + GH_TOKEN: ${{ steps.app-token.outputs.token }} |
| 26 | + slug: ${{ steps.app-token.outputs.app-slug }} |
| 27 | + run: | |
| 28 | + name="$slug[bot]" |
| 29 | + id=$(gh api "/users/$name" --jq .id) |
| 30 | + { |
| 31 | + echo "id=$id" |
| 32 | + echo "name=$name" |
| 33 | + echo "email=$id+$name@users.noreply.github.com" |
| 34 | + } >> "$GITHUB_OUTPUT" |
11 | 35 | - uses: actions/checkout@v4 |
| 36 | + - name: Setup Git |
| 37 | + env: |
| 38 | + name: ${{ steps.user-info.outputs.name || 'github-actions[bot]' }} |
| 39 | + email: ${{ steps.user-info.outputs.email || '41898282+github-actions[bot]@users.noreply.github.com' }} |
| 40 | + run: | |
| 41 | + git config user.name "$name" |
| 42 | + git config user.email "$email" |
12 | 43 | - name: Install Nix |
13 | 44 | uses: cachix/install-nix-action@v31 |
| 45 | + env: |
| 46 | + GH_TOKEN: ${{ steps.app-token.outputs.token || github.token }} |
14 | 47 | with: |
15 | 48 | extra_nix_config: | |
16 | | - access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} |
| 49 | + access-tokens = github.com=${{github.token}} |
17 | 50 | - name: Update flake.lock |
18 | 51 | uses: DeterminateSystems/update-flake-lock@v26 |
19 | 52 | with: |
| 53 | + token: ${{ steps.app-token.outputs.token || github.token }} |
| 54 | + git-committer-name: ${{ steps.user-info.outputs.name || 'github-actions[bot]' }} |
| 55 | + git-committer-email: ${{ steps.user-info.outputs.email || '41898282+github-actions[bot]@users.noreply.github.com' }} |
| 56 | + git-author-name: ${{ steps.user-info.outputs.name || 'github-actions[bot]' }} |
| 57 | + git-author-email: ${{ steps.user-info.outputs.email || '41898282+github-actions[bot]@users.noreply.github.com' }} |
| 58 | + pr-body: | |
| 59 | + Automated update by the [update-flake-lock] GitHub Action. |
| 60 | +
|
| 61 | + ``` |
| 62 | + {{ env.GIT_COMMIT_MESSAGE }} |
| 63 | + ``` |
| 64 | +
|
| 65 | + This PR was most recently updated by workflow run [${{ github.run_id }}]. |
| 66 | +
|
| 67 | + [update-flake-lock]: https://github.com/DeterminateSystems/update-flake-lock |
| 68 | + [${{ github.run_id }}]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
20 | 69 | pr-labels: | |
21 | 70 | merge-queue |
0 commit comments