Skip to content

Commit 951cfcd

Browse files
committed
build, microbench-ci: update token retrieval
This change updates the token retrieval to use gcloud instead of relying on target_pull_request to provide a token with the required permissions, to add labels or post to a PR. Epic: None Release note: None
1 parent 2c99066 commit 951cfcd

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

.github/workflows/microbenchmarks-ci.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: Microbenchmarks CI
22
on:
3-
pull_request_target:
3+
pull_request:
44
types: [ opened, reopened, synchronize ]
55
branches: [ master ]
66
concurrency:
@@ -91,7 +91,6 @@ jobs:
9191
env:
9292
BASE_SHA: ${{ needs.base.outputs.merge_base }}
9393
HEAD_SHA: ${{ env.HEAD }}
94-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9594
GITHUB_REPO: "cockroachdb/cockroach"
9695
GITHUB_PR_NUMBER: ${{ github.event.pull_request.number }}
9796
- name: Clean up

build/github/microbenchmarks/compare.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ for sha in "${shas[@]}"; do
2121
gcloud storage cp -r "gs://${storage_bucket}/artifacts/${sha}/${BUILD_ID}/*" "${working_dir}/${sha}/artifacts/"
2222
done
2323

24+
# Retrieve token (with logging disabled)
25+
set +x
26+
GITHUB_TOKEN=$(gcloud secrets versions access 1 --secret=cockroach-microbench-ga-token)
27+
export GITHUB_TOKEN
28+
set -x
29+
2430
# Compare the microbenchmarks
2531
./build/github/microbenchmarks/util.sh compare \
2632
--working-dir="$working_dir" \
@@ -31,6 +37,9 @@ done
3137
--new="$HEAD_SHA" \
3238
--post
3339

40+
# Clear the token
41+
unset GITHUB_TOKEN
42+
3443
cat "$output_dir/summary.md" > "$GITHUB_STEP_SUMMARY"
3544

3645
# Copy comparison results to GCS

0 commit comments

Comments
 (0)