The code post-script already has the behavior we want when CODE_ALLOWED_TARGET_BRANCHES is unset: it discovers the repository default branch through the forge API and falls back to main. If a user sets the variable, it becomes an explicit comma-separated allowlist (or *).
Right now, the base code harness maps CODE_ALLOWED_TARGET_BRANCHES: "${CODE_ALLOWED_TARGET_BRANCHES}" into env.runner. Harness validation therefore requires the host variable before the post-script can use its unset behavior. Jira code dispatches fail with:
validating env: env.runner[CODE_ALLOWED_TARGET_BRANCHES]: host variable CODE_ALLOWED_TARGET_BRANCHES is not set
Let’s keep this configuration optional. The base harness should not require the host variable; without an override, code runs should use the repository default branch. Repositories that want a narrower or broader policy can set CODE_ALLOWED_TARGET_BRANCHES in an extending harness.
Acceptance criteria:
- A code run succeeds without
CODE_ALLOWED_TARGET_BRANCHES in the host environment.
- An unset value uses the forge-detected default branch, with the existing
main fallback.
- An explicitly configured allowlist continues to be enforced.
- The base harness and documentation agree about the default behavior.
The code post-script already has the behavior we want when
CODE_ALLOWED_TARGET_BRANCHESis unset: it discovers the repository default branch through the forge API and falls back tomain. If a user sets the variable, it becomes an explicit comma-separated allowlist (or*).Right now, the base code harness maps
CODE_ALLOWED_TARGET_BRANCHES: "${CODE_ALLOWED_TARGET_BRANCHES}"intoenv.runner. Harness validation therefore requires the host variable before the post-script can use its unset behavior. Jira code dispatches fail with:Let’s keep this configuration optional. The base harness should not require the host variable; without an override, code runs should use the repository default branch. Repositories that want a narrower or broader policy can set
CODE_ALLOWED_TARGET_BRANCHESin an extending harness.Acceptance criteria:
CODE_ALLOWED_TARGET_BRANCHESin the host environment.mainfallback.