GHA builds only when Garnix fails evaluation check #247
Workflow file for this run
This file contains 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: NixOS | |
on: | |
pull_request: | |
paths-ignore: | |
- 'home/**' | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- 'GNOME.md' | |
- 'README.md' | |
- 'notes/**' | |
- '.git-crypt/**' | |
- '.gitattributes' | |
- '.gitignore' | |
- 'home/**' | |
- 'outputs/hm.nix' | |
- 'switch' | |
- '.mergify.yml' | |
- 'garnix.yaml' | |
jobs: | |
checks: | |
runs-on: ubuntu-latest | |
outputs: | |
garnix: ${{ steps.garnix.outputs.status }} | |
steps: | |
- uses: actions/[email protected] | |
# I got the check suite ID from: https://api.github.com/repos/gvolpe/nix-config/commits/REF/check-runs | |
# where REF == branch name (didn't work with the commit sha for some reason) | |
- name: "Check Garnix check status" | |
id: garnix | |
run: | | |
GARNIX_CHECK=$(curl -L \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/gvolpe/nix-config/check-suites/33419075802/check-runs | \ | |
jq -r '.check_runs | .[] | select (.output.text | contains("monthly CI quota")) | select (.status == "completed") | .conclusion') | |
echo "status=$GARNIX_CHECK" | tee -a "$GITHUB_OUTPUT" | |
build: | |
runs-on: ubuntu-latest | |
needs: checks | |
if: needs.checks.outputs.garnix != 'faaailure' | |
strategy: | |
fail-fast: true | |
matrix: | |
hostname: | |
- dell-xps | |
- thinkpad-x1 | |
- tongfang-amd | |
- xmod | |
steps: | |
- uses: actions/[email protected] | |
- name: "DEBUG" | |
run: | | |
echo "CHECK 0: ${{ needs.checks.outputs }}" | |
echo "CHECK 0: ${{ needs.checks.outputs.garnix }}" | |
echo "CHECK 1: ${{ needs.checks.outputs.status }}" | |
echo "CHECK 2: ${{ needs.checks.steps.garnix.outputs.status }}" | |
echo "CHECK 3: ${{ needs.checks.garnix.outputs.status }}" | |
echo "CHECK 4: ${{ needs.checks.garnix.outputs }}" | |
#- name: "Install Nix ❄️" | |
#uses: cachix/install-nix-action@v30 | |
#- name: "Install Cachix ❄️" | |
#uses: cachix/cachix-action@v15 | |
#with: | |
#name: gvolpe-nixos | |
#authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" | |
## Needed because cachix is also installed by Home Manager | |
#- name: "Set priority flag for Cachix 🚩" | |
#run: nix-env --set-flag priority 0 cachix | |
#- name: "Free Disk Space (Ubuntu)" | |
#uses: jlumbroso/free-disk-space@main | |
#with: | |
#tool-cache: true | |
#- name: "Build ${{ matrix.config_name }} NixOS config ❄️" | |
#run: nix build .#nixosConfigurations.${{ matrix.hostname }}.config.system.build.toplevel -L |