Skip to content

Update flakes

Update flakes #278

Workflow file for this run

name: "Update flakes"
on:
schedule:
- cron: "0 23 * * *"
workflow_dispatch: # click the button on Github repo!
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4.1.1
- uses: DeterminateSystems/nix-installer-action@v9
- uses: DeterminateSystems/magic-nix-cache-action@v3
- run: nix flake update
- name: Commit changes
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
FILE_TO_COMMIT: flake.lock
DESTINATION_BRANCH: main
run: |
export TODAY=$( date -u '+%Y-%m-%d' )
export MESSAGE="Flake update"
export SHA=$( git rev-parse $DESTINATION_BRANCH:$FILE_TO_COMMIT )
export CONTENT=$( base64 -i $FILE_TO_COMMIT )
if git diff --quiet flake.lock; then
exit 0
fi
gh api --method PUT /repos/:owner/:repo/contents/$FILE_TO_COMMIT \
--field message="$MESSAGE" \
--field content="$CONTENT" \
--field encoding="base64" \
--field branch="$DESTINATION_BRANCH" \
--field sha="$SHA"