From 2a1ce747d6c3193749474dcf516e2609cbaab742 Mon Sep 17 00:00:00 2001 From: Claudio Bley Date: Mon, 7 Nov 2022 12:10:15 +0100 Subject: [PATCH] Skip writing to the remote cache with no API key For foreign PRs (e.g. dependabot) access to the repository secrets is not permitted, so the API key for Buildbuddy ends up as empty. This leads to an error later: ``` WARNING: BES was not properly closed ERROR: The Build Event Protocol upload failed: Not retrying publishBuildEvents, no more attempts left: status='Status{code=UNAUTHENTICATED, description=failed to parse API key: missing API Key, cause=null}' UNAUTHENTICATED: UNAUTHENTICATED: failed to parse API key: missing API Key UNAUTHENTICATED: UNAUTHENTICATED: failed to parse API key: missing API Key ``` --- .github/workflows/workflow.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/workflow.yaml b/.github/workflows/workflow.yaml index de543df9b..3a7ab9ecb 100644 --- a/.github/workflows/workflow.yaml +++ b/.github/workflows/workflow.yaml @@ -20,9 +20,14 @@ jobs: BUILDBUDDY_API_KEY: ${{ secrets.BUILDBUDDY_API_KEY }} run: | cp .bazelrc.ci $HOME/.bazelrc + if [ -z "$BUILDBUDDY_API_KEY" ]; then + cache_setting='build --noremote_upload_local_results' + else + cache_setting="build --remote_header=x-buildbuddy-api-key=$BUILDBUDDY_API_KEY" + fi cat >>$HOME/.bazelrc <