Update devenv.lock #1
This file contains hidden or 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 devenv.lock" | |
| # Ensure that if the workflow is accidentally triggered twice (i.e. if it is manually triggered at the same time it is scheduled to run), only run it once | |
| concurrency: | |
| group: "update-workflow" | |
| cancel-in-progress: false | |
| on: | |
| schedule: | |
| - cron: "0 0 * * 6" # Runs weekly on Saturday at midnight UTC | |
| workflow_dispatch: # Allows manual triggering | |
| jobs: | |
| update: | |
| permissions: | |
| contents: write | |
| runs-on: ubuntu-latest | |
| # Use exact commit IDs instead of versions as recommended by Github | |
| steps: | |
| - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5 | |
| - uses: cachix/install-nix-action@4eae8bea4afaa8f8ea8aa638ab9a7fead2f3d21e # v31 | |
| - uses: cachix/cachix-action@97e5ff84d02b3b4f9936339f767e17f03c9252ed # v16 | |
| with: | |
| name: devenv | |
| - name: Install devenv.sh | |
| run: nix profile add nixpkgs#devenv | |
| - name: Update devenv.lock | |
| run: devenv update | |
| - name: Check for changes | |
| id: verify-changed-files | |
| run: | | |
| if git diff --quiet --exit-code -- devenv.lock; then | |
| echo "changed=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "changed=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit and push changes | |
| if: steps.verify-changed-files.outputs.changed == 'true' | |
| run: | | |
| git config user.name 'github-actions[bot]' | |
| git config user.email 'github-actions[bot]@users.noreply.github.com' | |
| git add devenv.lock | |
| git commit -m "chore: update devenv.lock" | |
| git pull --rebase origin "${GITHUB_REF_NAME}" | |
| git push origin "HEAD:${GITHUB_REF_NAME}" |