I have the service account key JSON stored as a secret, no errors in the file. Yet every time I run the action it keeps complaining about an unexpected token. What is wrong?
Error: google-github-actions/auth failed with: retry function failed after 1 attempt: failed to parse service account key JSON credentials: unexpected token in JSON at position 0
Service Account Key format:
{
"type": "service_account",
"project_id": "",
"private_key_id": "",
"private_key": "-----BEGIN PRIVATE KEY-----\\n-----END PRIVATE KEY-----\n",
"client_email": "",
"client_id": "",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": ""
}
Workflow:
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: $GOOGLE_CREDENTIALS
- id: 'upload-file'
name: 'Upload report to Google Cloud'
uses: 'google-github-actions/upload-cloud-storage@v0'
with:
path: $GITHUB_WORKSPACE/mochawesome-report
destination: api-test-results
parent: false
glob: '*.html'
- uses: 'google-github-actions/upload-cloud-storage@v0'
if: always()
env:
SLACK_URL: ${{ secrets.SLACK_URL }}
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
CodePudding user response:
maybe a typo in the auth
step? Just try:
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: ${{ secrets.GOOGLE_CREDENTIALS }}
instead of:
with:
credentials_json: $GOOGLE_CREDENTIALS