check on pr

This commit is contained in:
Daniel Winkler 2025-08-26 12:43:27 +10:00
commit 91b3a388e7
2 changed files with 41 additions and 1 deletions

View file

@ -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 }}

38
.github/workflows/check_pr.yml vendored Normal file
View file

@ -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.'
})