My problem is simple: I want to run code that depends on GOOGLE_APPLICATION_CREDENTIALS being set up correctly from a GitHub Actions secret.
The problem is that GOOGLE_APPLICATION_CREDENTIALS is expect to contain a path to a service account file, whether the secret contain the actual service account file content.
What's the best practice for that?
EDIT
Essentially I run a NodeJS script which connect to multiple GCP resources using client libraries (PubSub, BigQuery, etc). To my understanding, they can most easily work if GOOGLE_APPLICATION_CREDENTIALS env var is correctly defined.
You can use this GitHub action to log in. Pretty much you have to create a secret with the content of the service account and specified it as input:
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With