name: Weekly Flake Update on: schedule: - cron: "0 3 * * 1" # every Monday at 03:00 UTC workflow_dispatch: permissions: contents: write pull-requests: write jobs: flake_update: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: DeterminateSystems/nix-installer-action@v12 - name: Set branch name (date) id: vars run: | echo "branch=flake-update/$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT - name: Create update branch run: | git checkout -B ${{ steps.vars.outputs.branch }} - name: Update flake inputs run: | nix flake update - name: Commit changes run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add flake.lock git commit -m "chore: weekly flake update" || echo "No changes to commit" - name: Push branch run: | git push origin ${{ steps.vars.outputs.branch }} --force - name: Install GitHub CLI run: | sudo apt-get update sudo apt-get install -y gh - name: Create Pull Request run: | gh pr create \ --base main \ --head ${{ steps.vars.outputs.branch }} \ --title "[Automated] Weekly flake update $(date +%Y-%m-%d)" \ --body "Automated weekly update of flake inputs for $(date +%Y-%m-%d)." env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}