Skip to content

CI: fix access-token scope for get-next-version-code.sh - #686

Merged
Mansimran Singh (Mansimran-Singh) merged 1 commit into
mainfrom
feature/626/fix-gcloud-token-scope
Aug 19, 2026
Merged

CI: fix access-token scope for get-next-version-code.sh#686
Mansimran Singh (Mansimran-Singh) merged 1 commit into
mainfrom
feature/626/fix-gcloud-token-scope

Conversation

@Mansimran-Singh

Copy link
Copy Markdown
Collaborator

Summary

  • CI: fix Play Console edit auth scope and silent versionCode fallback #685's access_token_scopes fix on the google-github-actions/auth step was a no-op. Confirmed against the action's own docs: access_token_scopes only affects the action's access_token output, which only exists when token_format: access_token is set. Without it, get-next-version-code.sh's gcloud auth print-access-token reads the ADC credentials file directly and mints its own token, ignoring that setting entirely — and gcloud auth print-access-token has no --scopes flag to override it (confirmed against the gcloud CLI reference), so the token stayed scoped to the generic cloud-platform default, which the Android Publisher API's edits.insert rejects.
  • Fix: set token_format: access_token on the auth step so it actually produces a scoped access_token output, and pass that into get-next-version-code.sh via $ACCESS_TOKEN instead of shelling out to gcloud.
  • Also made the script print the actual Play API error response body when edit creation fails, instead of a generic message — the last two real failures both required pulling raw workflow logs to diagnose; this puts the actual cause directly in the log next time.

Ticket

Related to #626

Type of Change

  • New feature
  • Bug fix
  • Refactor
  • Tests
  • CI/CD
  • Documentation

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed

CI workflow/script change, no unit-testable logic. Verified the two candidate root causes (access_token_scopes requiring token_format, and print-access-token having no --scopes flag) against google-github-actions/auth's and gcloud's own documentation rather than guessing again after the last fix turned out to be inert. Real validation happens on the next merge to main.

Checklist

  • Tests pass locally (./gradlew testDebug)
  • No API keys or secrets in code
  • CLAUDE.md updated (if new pattern introduced)

PR #685's access_token_scopes fix turned out to be a no-op — confirmed
against google-github-actions/auth's docs: that setting only affects
the action's own `access_token` *output*, which is only generated when
`token_format: access_token` is set. Without it, get-next-version-code.sh's
`gcloud auth print-access-token` call reads the ADC credentials file
instead and mints its own token independent of that setting — and
`gcloud auth print-access-token` has no --scopes flag to force it
either, confirmed against the gcloud CLI reference.

Fix: set token_format: access_token on the auth step so it actually
generates a scoped access_token output, and thread that into the
script via $ACCESS_TOKEN instead of shelling out to gcloud. Also made
the script print the actual Play API error body on edit-creation
failure instead of a generic message, so the next failure (if any)
is diagnosable from the workflow log alone.

Related to #626.
@Mansimran-Singh
Mansimran Singh (Mansimran-Singh) merged commit 725596f into main Aug 19, 2026
2 checks passed
@Mansimran-Singh
Mansimran Singh (Mansimran-Singh) deleted the feature/626/fix-gcloud-token-scope branch August 19, 2026 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant