Skip to content

Flake

Flake #1403

Workflow file for this run

name: Flake
on:
schedule:
- cron: '0 1 * * *'
workflow_dispatch:
jobs:
update:
name: Update
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.commit.outputs.changed }}
head: ${{ steps.commit.outputs.head }}
steps:
- uses: DeterminateSystems/nix-installer-action@v15
with:
diagnostic-endpoint: ''
source-url: 'https://install.lix.systems/lix/lix-installer-x86_64-linux'
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.REPO_KEY }}
- name: Configure git
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
- run: nix -vL --show-trace flake update
- id: commit
name: Commit and stage changes
run: |
if ! git diff --exit-code --quiet flake.lock; then
git commit -m 'flake: update inputs' flake.lock
git push -f origin 'HEAD:ci/flake/${{ github.sha }}'
echo 'changed=true' >> $GITHUB_OUTPUT
echo 'head=ci/flake/${{ github.sha }}' >> $GITHUB_OUTPUT
fi
check:
name: Run Flake Checks
needs: [update]
if: needs.update.outputs.changed == 'true'
uses: ./.github/workflows/checks.yml
with:
ref_head: ${{ needs.update.outputs.head }}
secrets:
cachix_auth_token: ${{ secrets.CACHIX_AUTH_TOKEN }}
push:
name: Push
runs-on: ubuntu-latest
needs: [update, check]
if: needs.update.outputs.changed == 'true'
steps:
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.REPO_KEY }}
fetch-depth: 2
ref: ${{ needs.update.outputs.head }}
- name: Configure git
run: |
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
- name: Push changes
run: |
git pull --rebase origin '${{ github.ref }}'
git push origin 'HEAD:${{ github.ref }}'
git push origin -d '${{ needs.update.outputs.head }}'