Auto-update #1148
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: Auto-update | |
on: | |
repository_dispatch: | |
types: [auto_update] | |
schedule: # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule | |
- cron: '* 4 * * *' | |
workflow_dispatch: | |
jobs: | |
update-sources: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- uses: cachix/install-nix-action@v21 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
# extra_nix_config: | | |
# trusted-public-keys = hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= | |
# substituters = https://hydra.iohk.io https://cache.nixos.org/ | |
- run: nix flake update | |
- 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 '[email protected]' | |
[ ! -z "$(git status --porcelain)" ] && ( \ | |
git add flake.lock; \ | |
git commit -m "flake.lock updated $(date -u +%Y-%m-%d/%H:%M:%S-%Z)"; \ | |
git push; \ | |
echo "flake.lock update executed: $?" \ | |
) || echo "Nothing to commit." |