|
1 | 1 | # CI job to periodically (once a week) update flake.lock |
2 | 2 | name: Update flake dependencies |
3 | | - |
4 | 3 | on: |
5 | 4 | schedule: |
6 | 5 | - cron: '0 16 * * 5' |
7 | 6 | workflow_dispatch: # for allowing manual triggers of the workflow |
8 | | - |
9 | 7 | jobs: |
10 | 8 | update-dependencies: |
11 | 9 | runs-on: ubuntu-latest |
12 | 10 | steps: |
13 | | - - uses: actions/checkout@v4 |
14 | | - - uses: DeterminateSystems/nix-installer-action@main |
15 | | - - uses: DeterminateSystems/magic-nix-cache-action@main |
16 | | - - name: update flake.lock |
17 | | - run: nix flake update |
18 | | - - name: Create signed commit with flake.lock changes |
19 | | - env: |
20 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
21 | | - FILE_TO_COMMIT: flake.lock |
22 | | - COMMIT_BRANCH: automation/update-flake-dependencies |
23 | | - COMMIT_MESSAGE: "chore(nix): Update Flake dependencies" |
24 | | - run: | |
| 11 | + - uses: actions/checkout@v4 |
| 12 | + - uses: DeterminateSystems/nix-installer-action@main |
| 13 | + - uses: DeterminateSystems/magic-nix-cache-action@main |
| 14 | + - name: update flake.lock |
| 15 | + run: nix flake update |
| 16 | + - name: Create signed commit with flake.lock changes |
| 17 | + env: |
| 18 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 19 | + FILE_TO_COMMIT: flake.lock |
| 20 | + COMMIT_BRANCH: automation/update-flake-dependencies |
| 21 | + COMMIT_MESSAGE: "chore(nix): Update Flake dependencies" |
| 22 | + run: | |
25 | 23 | # make sure something actually changed first, if not, no updates required |
26 | 24 | if [[ `git status --porcelain` ]]; then |
27 | 25 | # create the branch on the remote |
|
30 | 28 | # commit via the GitHub API so we get automatic commit signing |
31 | 29 | gh api --method PUT /repos/1Password/shell-plugins/contents/$FILE_TO_COMMIT \ |
32 | 30 | --field message="$COMMIT_MESSAGE" \ |
33 | | - --field content=@<(base64 -i $FILE_TO_COMMIT) \ |
| 31 | + --field content="$(base64 -w 0 $FILE_TO_COMMIT)" \ |
34 | 32 | --field branch="$COMMIT_BRANCH" \ |
35 | 33 | --field sha="$(git rev-parse $COMMIT_BRANCH:$FILE_TO_COMMIT)" |
36 | 34 | gh pr create --title "[automation]: Update Flake dependencies" \ |
|
0 commit comments