Update flake inputs and npins #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: Update | |
on: | |
schedule: | |
- cron: "0 0 1,15 * *" # run on the 1st and 15th of every month | |
workflow_dispatch: | |
inputs: | |
dry-run: | |
description: "Dry run: if `true`, a pull request will not be made." | |
type: boolean | |
required: true | |
default: false | |
run-name: Update flake inputs and npins | |
env: | |
GIT_USERNAME: github-actions[bot] | |
GIT_EMAIL: github-actions[bot]@users.noreply.github.com | |
jobs: | |
update: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- uses: cachix/install-nix-action@v27 | |
with: | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Configure git | |
run: nix develop .#ci --impure --command configure-git-user.sh "${{ env.GIT_USERNAME }}" "${{ env.GIT_EMAIL }}" | |
- name: Update flake inputs | |
run: | | |
nix flake update | |
if [ -z "$(git status --porcelain=v1 2>/dev/null)" ]; then | |
echo "No changes from update" | |
else | |
git commit -am "chore(flake): update inputs" | |
fi | |
- name: Update npins | |
run: | | |
nix develop .#ci --impure --command npins -d "planet/pkgs/npins" update | |
nix develop .#ci --impure --command npins -d "planet/pkgs/vim-plugins/npins" update | |
if [ -z "$(git status --porcelain=v1 2>/dev/null)" ]; then | |
echo "No changes from update" | |
else | |
git commit -am "chore(planet/pkgs): update npins" | |
fi | |
- if: ${{ !inputs.dry-run }} | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.PR_PAT }} | |
branch: update-flake-inputs-and-npins | |
title: Update flake inputs and npins | |
body: ${{ github.event_name == 'workflow_dispatch' && 'Manually triggered update.' || 'Automated periodic update.' }} |