Skip to content

Auto-update

Auto-update #597

Workflow file for this run

name: Auto-update
on:
workflow_dispatch:
pull_request:
types:
- opened
- synchronize
paths:
- '.github/workflows/auto-update.js'
- 'auto-update/lib.js'
- '.github/workflows/auto-update.yml'
schedule:
- cron: "30 11 */2 * *"
jobs:
update-sources:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: "Update sources"
uses: actions/github-script@v6
id: update-sources
with:
result-encoding: string
script: |
const script = require('./.github/workflows/auto-update.js')
return await script({github, context, core, require})
- name: Commit updated flake
env:
GITHUB_JOB: ${{ env.GITHUB_JOB }}
GITHUB_RUN_ID: ${{ env.GITHUB_RUN_ID }}
run: |
git config --global user.name 'UpdateBot'
git config --global user.email 'ulrikstrid@users.noreply.github.com'
git checkout -b "auto-update-sources-$GITHUB_RUN_ID"
git add flake.nix flake.lock
git commit -m "Update sources"
git push --set-upstream origin "auto-update-sources-$GITHUB_RUN_ID"
- name: Open pull request
uses: repo-sync/pull-request@v2
env:
GITHUB_JOB: ${{ env.GITHUB_JOB }}
GITHUB_RUN_ID: ${{ env.GITHUB_RUN_ID }}
with:
destination_branch: "master"
source_branch: auto-update-sources-${{ github.run_id }}
pr_title: "Update sources"
pr_body: ":robot_face: Updating sources to the latest version.\n${{steps.update-sources.outputs.result}}"
pr_reviewer: "anmonteiro,ulrikstrid"
pr_assignee: "anmonteiro,ulrikstrid"
github_token: ${{ secrets.GH_PAT_ANMONTEIRO }}