Skip to content

Commit

Permalink
chore: fix release-metrics action (#83)
Browse files Browse the repository at this point in the history
Change-Id: Ibba624fd7ff808cd9b90934eae9853f3dcdd0a56
  • Loading branch information
drstrangelooker authored Nov 7, 2024
1 parent ee1b470 commit d36c0e9
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/release-metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_BQ_METRICS_KEY }}
project_id: ${{ secrets.GCP_PROJECT_ID }}
service_account_key: ${{ secrets.GCP_BQ_METRICS_KEY }}
export_default_credentials: true
create_credentials_file: true
export_environment_variables: true

- name: Debug event json
run: cat $GITHUB_EVENT_PATH
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2

- name: Check for release key
run: echo "HAS_RELEASE_KEY=$(jq 'has("release")' $GITHUB_EVENT_PATH)" >> $GITHUB_ENV
Expand All @@ -39,6 +40,8 @@ jobs:
if: ${{env.HAS_RELEASE_KEY== 'true'}}
run: cat releases.json

- name: Send release.json to BQ
if: ${{env.HAS_RELEASE_KEY== 'true'}}
run: bq load --source_format=NEWLINE_DELIMITED_JSON metrics.releases releases.json
# Avoid rate limit exceeded error in bq load step
- name: Sleep for random time
run: sleep $((RANDOM % 120))

- run: bq load --source_format=NEWLINE_DELIMITED_JSON metrics.releases releases.json

0 comments on commit d36c0e9

Please sign in to comment.