Skip to content

Commit c962db9

Browse files
Skip attach static libs if required secret is missing for external PRs (#908)
1 parent f5efecc commit c962db9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

.github/workflows/attach-static-libs.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ jobs:
3838
target: aarch64-apple-darwin
3939
- os: macos-13
4040
target: x86_64-apple-darwin
41+
outputs:
42+
has_secrets: ${{ steps.check_secrets.outputs.has_secrets }}
4143
steps:
4244
- uses: actions/checkout@v4
4345
- uses: dtolnay/rust-toolchain@stable
@@ -56,12 +58,24 @@ jobs:
5658
path: target/${{ matrix.target }}/maxperf/libfirewood_ffi.a
5759
if-no-files-found: error
5860

61+
- name: Check if FIREWOOD_GO_GITHUB_TOKEN is set
62+
id: check_secrets
63+
run: |
64+
if [ -z "${{ secrets.FIREWOOD_GO_GITHUB_TOKEN }}" ]; then
65+
echo "FIREWOOD_GO_GITHUB_TOKEN is not set"
66+
echo "has_secrets=false" >> "$GITHUB_OUTPUT"
67+
else
68+
echo "FIREWOOD_GO_GITHUB_TOKEN is set"
69+
echo "has_secrets=true" >> "$GITHUB_OUTPUT"
70+
fi
71+
5972
# Collect all the static libraries built on the previous matrix of jobs
6073
# and add them into ffi/libs directory.
6174
# We commit and push this as a new branch with "--force" to overwrite
6275
# the previous static libs that will not be on our branch.
6376
push-firewood-ffi-libs:
6477
needs: build-firewood-ffi-libs
78+
if: needs.build-firewood-ffi-libs.outputs.has_secrets == 'true'
6579
runs-on: ubuntu-latest
6680
outputs:
6781
target_branch: ${{ steps.determine_branch.outputs.target_branch }}

0 commit comments

Comments
 (0)