-
-
Notifications
You must be signed in to change notification settings - Fork 5
39 lines (37 loc) · 1.49 KB
/
update-flake.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Update flake dependencies
on:
schedule:
- cron: '0 16 * * 5'
workflow_dispatch: # for allowing manual triggers of the workflow
jobs:
update-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: cachix/cachix-action@v15
with:
name: mrjones2014-dotfiles
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Add nix-community cache
run: cachix use nix-community
- name: update flake.lock
run: nix flake update
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
id: create-pr
with:
commit-message: "flake: update dependencies"
title: "[automation] update flake dependencies"
branch: "automation/update-flake-dependencies"
token: ${{ secrets.UPDATE_FLAKE_TOKEN }}
- name: Enable PR auto-merge on CI success
run: gh pr merge --squash --delete-branch --auto ${{ steps.create-pr.outputs.pull-request-number }}
- name: Ping me in a comment on the PR
run: |
PR_NUMBER=${{ steps.create-pr.outputs.pull-request-number }}
COMMENT="Ping @mrjones2014"
GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"$COMMENT\"}"