diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c157b8d..eb62041 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,7 +1,6 @@ name: "Test template" on: workflow_dispatch: # allows manual triggering - pull_request: push: jobs: tests: @@ -11,6 +10,9 @@ jobs: os: [ubuntu-latest] steps: - uses: actions/checkout@v4 + - uses: wimpysworld/nothing-but-nix@main + with: + ️hatchet-protocol: 'carve' - uses: cachix/install-nix-action@v31 with: github_access_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/check_pr.yml b/.github/workflows/check_pr.yml new file mode 100644 index 0000000..ca07feb --- /dev/null +++ b/.github/workflows/check_pr.yml @@ -0,0 +1,38 @@ +name: "Test template PR" +on: + workflow_dispatch: # allows manual triggering + pull_request: + types: [opened, synchronize, reopened] + pull_request_target: + types: [opened, synchronize, reopened] +jobs: + tests: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + token: ${{ secrets.GITHUB_TOKEN }} + - uses: wimpysworld/nothing-but-nix@main + with: + ️hatchet-protocol: 'carve' + - uses: cachix/install-nix-action@v31 + with: + github_access_token: ${{ secrets.GITHUB_TOKEN }} + - uses: DeterminateSystems/magic-nix-cache-action@main + - run: nix build ./templates/n + - run: nix flake check ./templates/n + - name: Comment on PR (if tests fail) + if: failure() + uses: actions/github-script@main + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: '❌ Tests failed on this pull request. Please check the workflow logs for details.' + })