Skip to content

Nix Package

Nix Package #9

Workflow file for this run

name: Nix CI
on:
push:
pull_request:
jobs:
check-hashes:
name: Ensure Nix Hashes are up-to-date
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check if relevant files changed
shell: bash
id: check
run: |
# most sane regex
# checks if one of these files/directories has been touched
# - package.json
# - package-lock.json
# - nix/
# - composer.json
# - composer.lock
if [ -n "$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} | grep -P '^(?:package(?:-lock)?\.json$|nix\/|composer\.(?:json|lock)$)')" ]; then
echo "File(s) changed so this job runs"
else
echo "no files changed so we exit neutrally"
echo "skip=true" >> "$GITHUB_OUTPUT"
fi
- name: Install nix
if: "steps.check.outputs.skip != 'true'"
uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
# - uses: cachix/cachix-action@v12
# with:
# name: trawelling
# authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Update generated files
if: "steps.check.outputs.skip != 'true'"
run: nix develop --impure .#ci --command "update-nix-package-deps"
- name: Check if up-to-date
shell: bash
id: check

Check failure on line 44 in .github/workflows/nix-ci.yml

View workflow run for this annotation

GitHub Actions / Nix CI

Invalid workflow file

The workflow is not valid. .github/workflows/nix-ci.yml (Line: 44, Col: 13): The identifier 'check' may not be used more than once within the same scope.
if: "steps.check.outputs.skip != 'true'"
run: |
if [[ ! -z $(git status -s) ]]; then
git status
echo "up-to-date=false" >> "$GITHUB_OUTPUT"
fi
- name: Find Comment
uses: peter-evans/find-comment@v2
if: "steps.check.outputs.skip != 'true' && github.event_name == 'pull_request' && steps.check.outputs.up-to-date == 'false'"
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: The composer or npm dependencies are out of sync with the generated nix files.
- name: Create comment
if: "steps.check.outputs.skip != 'true' && steps.fc.outputs.comment-id == '' && github.event_name == 'pull_request' && steps.check.outputs.up-to-date == 'false'"
uses: peter-evans/create-or-update-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
The composer or npm dependencies are out of sync with the generated nix files.
Please update the files by either running the `update-nix-package-dep` script locally
or let GitHub actions do it by running `/nix-update`.
*This comment was written by a bot!* 🤖
- name: Fail Build
if: "steps.check.outputs.skip != 'true' && steps.check.outputs.up-to-date == 'false'"
shell: bash
run: exit 1
build:
name: Build Package
runs-on: ubuntu-latest
needs:
- check-hashes
steps:
- uses: actions/checkout@v3
- name: Install nix
uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=channel:nixos-unstable
# - uses: cachix/cachix-action@v12
# with:
# name: trawelling
# authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build with nix
run: nix build