Skip to content

Commit

Permalink
fix: avoid excessive warning annotations in multi-use workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
erzz committed May 9, 2022
1 parent 3669d20 commit 88f7bbf
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,24 +48,29 @@ runs:
using: "composite"
steps:
- name: Authenticate to GCP (OIDC)
id: oidc
if: ${{ inputs.gcp-auth-type == 'oidc' }}
uses: google-github-actions/auth@v0
with:
token_format: access_token
workload_identity_provider: ${{ inputs.workload-identity-provider }}
service_account: ${{ inputs.service-account }}
create_credentials_file: true
export_environment_variables: false

- name: Authenticate to GCP (SA Key)
id: sa-key
if: ${{ inputs.gcp-auth-type == 'sa-key' }}
uses: google-github-actions/auth@v0
with:
credentials_json: ${{ inputs.service-account-keyfile }}
create_credentials_file: true
export_environment_variables: false

- name: Send metric
shell: bash
env:
AUTH_TYPE: ${{ inputs.gcp-auth-type }}
GOOGLE_CLOUD_PROJECT: ${{ inputs.google-cloud-project }}
TEAM: ${{ inputs.team}}
SERVICE: ${{ inputs.service }}
Expand All @@ -75,5 +80,12 @@ runs:
VERSION: ${{ inputs.version }}
METRIC_VALUE: ${{ inputs.metric-value }}
run: |
if [[ "$AUTH_TYPE" == "oidc" ]]; then
export GOOGLE_APPLICATION_CREDENTIALS=${{ steps.oidc.outputs.credentials_file_path }}
elif [[ "$AUTH_TYPE" == "sa-key" ]]; then
export GOOGLE_APPLICATION_CREDENTIALS=${{ steps.sa-key.outputs.credentials_file_path }}
else
echo "Could not determine the path to the credentials file, exiting." && exit 1
fi
python -m pip install google-cloud-monitoring
python3 ${{ github.action_path }}/push_deploy_metric.py --team "$TEAM" --service "$SERVICE" --environment "$ENVIRONMENT" --status "$STATUS" --result "$RESULT" --version "$VERSION" --metric-value "$METRIC_VALUE"

0 comments on commit 88f7bbf

Please sign in to comment.