Skip to content

Commit 67e87e5

Browse files
authored
Accept public PRs for CI (#1111)
This PR removes usages of github secrets in the testing workflow run on CI; this means that external contributors should be able to open PRs from forked repos properly. Making the change here required one step more than the K repo needed (moving a cachix push from testing to release), but I'm pretty confident everything is wired up correctly.
1 parent 0399026 commit 67e87e5

File tree

2 files changed

+37
-10
lines changed

2 files changed

+37
-10
lines changed

.github/workflows/release.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,48 @@ jobs:
7878
--yes \
7979
--cleanup-tag
8080
81+
cachix:
82+
name: 'Publish to Cachix'
83+
strategy:
84+
fail-fast: false
85+
matrix:
86+
include:
87+
- runner: [self-hosted, linux, normal]
88+
os: ubuntu-24.04
89+
- runner: MacM1
90+
os: self-macos-12
91+
92+
runs-on: ${{ matrix.runner }}
93+
steps:
94+
- name: 'Check out code'
95+
uses: actions/checkout@v4
96+
97+
- name: 'Install Nix'
98+
if: ${{ !startsWith(matrix.os, 'self') }}
99+
uses: cachix/install-nix-action@v22
100+
with:
101+
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
102+
extra_nix_config: |
103+
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
104+
105+
- name: 'Install Cachix'
106+
uses: cachix/cachix-action@v12
107+
with:
108+
name: k-framework
109+
authToken: '${{ secrets.CACHIX_PUBLIC_TOKEN }}'
110+
skipPush: true
111+
112+
- name: 'Push Flake to Cachix'
113+
run: |
114+
GC_DONT_GC=1 nix build --print-build-logs . --json \
115+
| jq -r '.[].outputs | to_entries[].value' \
116+
| cachix push k-framework
81117
82118
release:
83119
name: 'Publish Release'
84120
runs-on: ubuntu-latest
85121
environment: production
86-
needs: build-ubuntu-package
122+
needs: [build-ubuntu-package, cachix]
87123
steps:
88124
- name: 'Check out code'
89125
uses: actions/checkout@v4

.github/workflows/test.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,11 @@ jobs:
3232
uses: cachix/install-nix-action@v22
3333
with:
3434
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
35-
extra_nix_config: |
36-
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
3735

3836
- name: 'Install Cachix'
3937
uses: cachix/cachix-action@v12
4038
with:
4139
name: k-framework
42-
authToken: '${{ secrets.CACHIX_PUBLIC_TOKEN }}'
4340
skipPush: true
4441

4542
- name: 'Build LLVM backend'
@@ -51,12 +48,6 @@ jobs:
5148
- name: 'Test LLVM backend'
5249
run: GC_DONT_GC=1 nix flake check --print-build-logs
5350

54-
- name: 'Push Flake to Cachix'
55-
run: |
56-
GC_DONT_GC=1 nix build --print-build-logs . --json \
57-
| jq -r '.[].outputs | to_entries[].value' \
58-
| cachix push k-framework
59-
6051
build-from-source:
6152
name: 'Build LLVM backend from source'
6253
runs-on: [self-hosted, linux, normal]

0 commit comments

Comments
 (0)