Skip to content

Commit 128ef28

Browse files
grichaclaude
andauthored
feat(warden): Upload findings to GCS via Workload Identity Federation (#176)
* feat(warden): Upload findings to GCS via Workload Identity Federation Authenticate to GCP using OIDC workload identity and upload warden findings JSON to the warden-logs bucket after each PR scan. Files are stored as timestamped JSON under org/repo paths for downstream analysis. Co-Authored-By: Claude <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/1bzpd9bFJDpsTMflTcligEabMBUvuiHXGg3hoDQHdvI * fix(warden): Address review feedback on GCS upload steps Move GCP auth after warden scan with continue-on-error so auth failures don't block scanning. Guard rename/upload on findings-file being non-empty. Use env var instead of direct expression interpolation. Co-Authored-By: Claude <noreply@anthropic.com> Agent transcript: https://claudescope.sentry.dev/share/BKBjQj046vaZRSSn53ACddWCi8IA4OfcDBXrt63hk7U * fix(warden): Add continue-on-error to GCS upload step Prevent upload failures (e.g. from failed GCP auth) from failing the entire workflow job. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent c365b23 commit 128ef28

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

.github/workflows/warden.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010
permissions:
1111
contents: read
12+
id-token: write
1213
env:
1314
WARDEN_ANTHROPIC_API_KEY: ${{ secrets.WARDEN_ANTHROPIC_API_KEY }}
1415
WARDEN_MODEL: ${{ secrets.WARDEN_MODEL }}
@@ -25,6 +26,32 @@ jobs:
2526
owner: ${{ github.repository_owner }} # access to all repos, cause this is triggered on org level
2627

2728
- uses: getsentry/warden@v0
29+
id: warden
2830
continue-on-error: true # throw no error for now
2931
with:
30-
github-token: ${{ steps.app-token.outputs.token }}
32+
github-token: ${{ steps.app-token.outputs.token }}
33+
34+
- name: Authenticate to Google Cloud
35+
continue-on-error: true
36+
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093
37+
with:
38+
workload_identity_provider: projects/868781662168/locations/global/workloadIdentityPools/prod-github/providers/github-oidc-pool
39+
service_account: gha-warden@sac-prod-sa.iam.gserviceaccount.com
40+
41+
- name: Rename findings file with timestamp
42+
id: rename-findings
43+
if: always() && steps.warden.outputs.findings-file != ''
44+
env:
45+
FINDINGS_FILE: ${{ steps.warden.outputs.findings-file }}
46+
run: |
47+
DEST="$RUNNER_TEMP/$(date -u +%Y-%m-%dT%H%M%SZ).json"
48+
cp "$FINDINGS_FILE" "$DEST"
49+
echo "path=$DEST" >> "$GITHUB_OUTPUT"
50+
51+
- name: Upload findings to GCS
52+
continue-on-error: true
53+
uses: google-github-actions/upload-cloud-storage@c0f6160ff80057923ff50e5e567695cea181ec23 # v2
54+
if: always() && steps.rename-findings.outputs.path != ''
55+
with:
56+
path: ${{ steps.rename-findings.outputs.path }}
57+
destination: warden-logs/${{ github.repository }}

0 commit comments

Comments
 (0)