about summary refs log tree commit diff
path: root/.github/workflows/update.yml
blob: 3cf341417f9fff2430587324cc9c2b6f72c2e96d (plain) (blame)
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
name: Nix Autoupdater

on:
  workflow_dispatch: {}
  schedule:
  - cron: '0 0 * * *'

jobs:
  update-packages:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    - uses: cachix/install-nix-action@v22
      with:
        extra_nix_config: |
          access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
          accept-flake-config = true
    - run: |
        nix shell nixpkgs#git -c git config user.name 'NixBot'
        nix shell nixpkgs#git -c git config user.email 'fcuny@users.noreply.github.com'
        nix flake update
        nix shell nixpkgs#git -c git commit -am "[Auto] update all inputs"

    - name: Create Pull Request
      uses: peter-evans/create-pull-request@v5
      id: cpr
      with:
        commit-message: '[Auto] Package updates'
        committer: GitHub <noreply@github.com>
        author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
        signoff: false
        branch: package-auto-updates
        delete-branch: true
        title: '[Auto] Package updates'
        body: ''
        labels: |
          automated pr
        assignees: fcuny
        reviewers: fcuny

    - name: Enable Pull Request Automerge
      if: steps.cpr.outputs.pull-request-operation == 'created'
      uses: peter-evans/enable-pull-request-automerge@v3
      with:
        token: ${{ secrets.MACHINE_USER_TOKEN }}
        pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
        merge-method: squash