-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
GHA builds only when Garnix fails evaluation check (#286)
- Loading branch information
Showing
3 changed files
with
68 additions
and
30 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Garnix status check | ||
description: Determines whether to build the Nix config on GHA or not based on the Garnix status check | ||
inputs: | ||
github_token: | ||
required: true | ||
outputs: | ||
status: | ||
description: "The status check response, which may be failure or success" | ||
value: ${{ steps.garnix.outputs.status }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
# 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: Garnix check status | ||
id: garnix | ||
shell: bash | ||
run: | | ||
STATUS=$(curl -L \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ inputs.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=$STATUS" | tee -a "$GITHUB_OUTPUT" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,9 +19,28 @@ on: | |
- 'garnix.yaml' | ||
|
||
jobs: | ||
checks: | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
garnix: ${{ steps.garnix.outputs.status }} | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Garnix check status | ||
id: garnix | ||
uses: ./.github/actions/garnix-check | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
|
||
needs: checks | ||
|
||
if: needs.checks.outputs.garnix == 'failure' | ||
|
||
strategy: | ||
fail-fast: true | ||
matrix: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,12 @@ | ||
name: NixOS | ||
|
||
on: | ||
check_run: | ||
types: [failure] | ||
pull_request: | ||
paths-ignore: | ||
- 'home/**' | ||
push: | ||
branches: | ||
- master | ||
paths-ignore: | ||
- 'GNOME.md' | ||
- 'README.md' | ||
|
@@ -15,34 +19,29 @@ on: | |
- 'switch' | ||
- '.mergify.yml' | ||
- 'garnix.yaml' | ||
#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] | ||
|
||
- name: Garnix check status | ||
id: garnix | ||
uses: ./.github/actions/garnix-check | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
build: | ||
runs-on: ubuntu-latest | ||
|
||
#if: github.action == 'Garnix CI / Evaluate flake.nix' | ||
#if: >- | ||
#github.event.state == 'error' || | ||
#github.event.state == 'failure' | ||
needs: checks | ||
|
||
if: needs.checks.outputs.garnix == 'failure' | ||
|
||
strategy: | ||
fail-fast: true | ||
|
@@ -56,11 +55,6 @@ jobs: | |
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: "DEBUG" | ||
run: | | ||
echo "Event state: ${{ github.event.state }}" | ||
echo "Event desc: ${{ github.event.description }}" | ||
- name: "Install Nix ❄️" | ||
uses: cachix/install-nix-action@v30 | ||
|
||
|