generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (72 loc) · 3.06 KB
/
update-deps.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Update Dependencies
on:
schedule:
- cron: "0 */6 * * *"
workflow_dispatch:
jobs:
flake-update:
runs-on: ubuntu-latest
strategy:
matrix:
input:
- nixpkgs
- pre-commit-hooks
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Install Nix
uses: cachix/install-nix-action@v16
with:
nix_path: nixpkgs=channel:nixos-unstable-small
extra_nix_config: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Get current commit
uses: cpcloud/flake-dep-info-action@main
id: get_current_commit
with:
input: ${{ matrix.input }}
- name: Update ${{ matrix.input }}
run: nix flake lock --update-input ${{ matrix.input }}
- name: Get new commit
uses: cpcloud/flake-dep-info-action@main
id: get_new_commit
with:
input: ${{ matrix.input }}
- name: Get commit details for ${{ matrix.input }} changes
uses: cpcloud/compare-commits-action@v5.0.10
id: compare_commits
if: ${{ steps.get_current_commit.outputs.rev != steps.get_new_commit.outputs.rev }}
with:
owner: ${{ steps.get_new_commit.outputs.owner }}
repo: ${{ steps.get_new_commit.outputs.repo }}
basehead: ${{ steps.get_current_commit.outputs.rev }}...${{ steps.get_new_commit.outputs.rev }}
token: ${{ secrets.GITHUB_TOKEN }}
include-merge-commits: false
- name: Generate a GitHub token
uses: tibdex/github-app-token@v1
if: ${{ steps.get_current_commit.outputs.rev != steps.get_new_commit.outputs.rev }}
id: generate_token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Create a pull request to update ${{ matrix.input }}
if: ${{ steps.get_current_commit.outputs.rev != steps.get_new_commit.outputs.rev }}
id: create_pr
uses: peter-evans/create-pull-request@v3
with:
commit-message: "chore(flake/${{ matrix.input }}): ${{ steps.get_current_commit.outputs.short-rev }} -> ${{ steps.get_new_commit.outputs.short-rev }}"
branch: "create-pull-request/update-${{ matrix.input }}"
delete-branch: true
author: "Phillip Ground <cpcloudbot@gmail.com>"
title: "chore(flake/${{ matrix.input }}): `${{ steps.get_current_commit.outputs.short-rev }}` -> `${{ steps.get_new_commit.outputs.short-rev }}`"
token: ${{ steps.generate_token.outputs.token }}
body: ${{ steps.compare_commits.outputs.differences }}
labels: dependencies,autorebase:opt-in
- name: Set the PR to automerge
if: ${{ steps.create_pr.outputs.pull-request-operation == 'created' }}
uses: peter-evans/enable-pull-request-automerge@v1
with:
token: ${{ steps.generate_token.outputs.token }}
pull-request-number: ${{ steps.create_pr.outputs.pull-request-number }}
merge-method: rebase