UID2-6753: declare GH_MERGE_TOKEN as optional workflow_call secret#226
Merged
BehnamMozafari merged 2 commits intomainfrom May 4, 2026
Merged
UID2-6753: declare GH_MERGE_TOKEN as optional workflow_call secret#226BehnamMozafari merged 2 commits intomainfrom
BehnamMozafari merged 2 commits intomainfrom
Conversation
Allows callers to pass the merge PAT explicitly via
`secrets: { GH_MERGE_TOKEN: ${{ secrets.GH_MERGE_TOKEN }} }`, which is
the only path that works for cross-organization callers. The existing
`secrets: inherit` flow continues to work (the secret is inherited as
before for same-org/same-enterprise callers, and now for org-level
secrets cross-org as well).
Background: when called cross-organization (e.g. UnifiedID2/uid2-snowflake
calling IABTechLab/uid2-shared-actions), `secrets: inherit` does not
propagate environment-scoped secrets. See
actions/runner#1490.
The expression `secrets.GH_MERGE_TOKEN` inside this workflow is unchanged,
so behaviour is fully backward compatible: when the caller passes nothing
and the secret is not inherited, the value is empty and `commit_pr_and_merge`
falls back to GITHUB_TOKEN (current behaviour).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
swibi-ttd
approved these changes
May 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Declares
GH_MERGE_TOKENas an optionalworkflow_call.secretsentry onshared-publish-java-to-docker-versioned.yaml. Existing callers are unaffected; cross-organization callers can now pass the token explicitly.Problem
The reusable workflow needs a PAT (
GH_MERGE_TOKEN) to merge the version-bump PR back to the default branch when branch protection requires bypass. The expressionrelies on the secret being available inside this workflow's
secretscontext.When the caller is in the same organization (e.g.
IABTechLab/uid2-core),secrets: inheritplus the called job'senvironment: ci-auto-mergecorrectly exposes the env-scoped secret to the called workflow, andcommit_pr_and_mergereceives the token (verified — seewith: github_token: ***in any recent uid2-core release).When the caller is in a different organization (e.g.
UnifiedID2/uid2-snowflake),secrets: inheritdoes not propagate environment-scoped secrets to the called workflow'ssecretscontext. The expression collapses to'',commit_pr_and_mergefalls back toGITHUB_TOKEN, which has no bypass on the caller's PR-review ruleset, and the merge step fails with HTTP 405 "New changes require approval from someone other than the last pusher" — see the failure on UnifiedID2/uid2-snowflake#25202341348.References:
secrets: inheritand thesecrets:map on auses:job.Change
Add an optional
secrets:declaration toworkflow_call:The existing two
github_token: ${{ inputs.merge_environment != '' && secrets.GH_MERGE_TOKEN || '' }}references are unchanged.Why this is backward compatible
secrets: inheritcontinue to work exactly as before. Declaring a secret onworkflow_call.secretsdoes not changeinheritsemantics.secrets:block at all) continue to work — the optional secret is empty,inputs.merge_environmentis''by default, and the action falls back toGITHUB_TOKEN. This matches today's behaviour for callers that don't opt into auto-merge.GH_MERGE_TOKENaccessible at repo or org level (a job that calls a reusable workflow cannot itself declareenvironment:, so env-scoped-only secrets are not readable in the caller's evaluation context).Follow-up
A companion PR will switch
UnifiedID2/uid2-snowflake/.github/workflows/publish-docker.yamlto the explicit pass form, paired with the org-levelGH_MERGE_TOKENrecently added inuid2-okta-configuration(commit2714fb1).Test plan
v3floating tag advances.IABTechLab/uid2-corerelease onmain— should still succeed viasecrets: inherit(no caller change).UnifiedID2/uid2-snowflake/publish-docker.yamlonmain— should succeed;commit_pr_and_mergestep should showgithub_token: ***in its inputs.