Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use GOOGLE_APPLICATION_CREDENTIALS env var with GitHub Actions secret

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.

like image 577
galah92 Avatar asked Jun 15 '26 22:06

galah92


1 Answers

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 }}'
like image 178
javierlga Avatar answered Jun 18 '26 12:06

javierlga



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!