Skip to content

ci: skip ai-rebase when its token is not configured (Refs #4461) - #4730

Closed
KelboLive wants to merge 2 commits into
obs-rust:masterfrom
KelboLive:ci/4461-ai-rebase-token-guard
Closed

KelboLive wants to merge 2 commits into
obs-rust:masterfrom
KelboLive:ci/4461-ai-rebase-token-guard

Conversation

@KelboLive

Copy link
Copy Markdown
Contributor

Refs #4461. actions/checkout in .github/workflows/ai-rebase.yaml fails with Input required and not supplied: token when AI_REBASE_TOKEN is unset, so optional master pushes armed the job, paid for setup, then died before its rebase logic (run 42724921146 of the #4450 push).RED (e70b5cb): ci/test_ai_rebase_token_guard.py pins that every root job reading secrets.AI_REBASE_TOKEN carries a configured guard; it fails against the current yaml (only the real-yaml case fails; parser cases pass).GREEN (ae0f6e7): fold secrets.AI_REBASE_TOKEN != '' into the root job if: alongside the existing fork guard, so an unconfigured repo skips the optional job instead of failing checkout. The fork-guard substring is preserved, so ci/test_workflow_schedule_guard.py still passes.Local validation: ci/test_ai_rebase_token_guard.py, ci/test_workflow_schedule_guard.py and ci/test_workflow_duplicate_keys.py pass (17 tests) on the branch tip; the yaml parses with PyYAML; git diff --check clean. ./lint fails here only from environment noise (spaces in this workspace path break the uvx-pinned spawn; and default cp1252 needs PYTHONUTF8=1), unrelated to the change.

obs-rust worker added 2 commits November 11, 2026 13:20
Refs obs-rust#4461. The check fails against the current ai-rebase.yaml: its
root job reads secrets.AI_REBASE_TOKEN in steps with no configured
guard, so checkout paid for setup and then died. GREEN adds the guard.
Refs obs-rust#4461. Fold secrets.AI_REBASE_TOKEN != '' into the root job if
alongside the fork guard, so an unconfigured repository skips the
optional job instead of failing actions/checkout with a missing token.

Ci-Attestation: local RED/GREEN pairs for ci/test_ai_rebase_token_guard
and ci/test_workflow_schedule_guard; 9 unit tests pass on the branch tip.
@KelboLive
KelboLive marked this pull request as ready for review November 11, 2026 21:45
@KelboLive
KelboLive requested a review from zackees as a code owner November 11, 2026 21:45
@KelboLive

Copy link
Copy Markdown
Contributor Author

Marked ready for review. Local evidence: RED/GREEN pair is on the branch tip; uv run python -m unittest ci/test_ai_rebase_token_guard.py (4 tests) and ci/test_workflow_schedule_guard.py (5 tests) both pass at ae0f6e73c. Handed off to the coordinator for the merge queue.

@wesleyhawes

Copy link
Copy Markdown
Contributor

The new job-level condition makes this workflow invalid, including when the token is configured. On ae0f6e7, actionlint 1.7.11 reports:

actionlint -shellcheck= -pyflakes= .github/workflows/ai-rebase.yaml
context "secrets" is not allowed here. available contexts are "github", "inputs", "needs", "vars"

GitHub's context availability table excludes secrets from jobs.<job_id>.if. The new string-matching test currently requires that invalid expression, so its passing result misses this failure.

One valid option is to retain the existing job-level fork guard, set a job environment flag, and guard all five steps (checkout, uv, soldr, clud, and rebase):

env:
  AI_REBASE_ENABLED: ${{ secrets.AI_REBASE_TOKEN != '' }}
# On each step:
if: env.AI_REBASE_ENABLED == 'true'

I applied that alternative to a temporary copy of this exact workflow: actionlint passes. It skips setup when the token is absent, although a runner still starts. Avoiding that runner requires a separately maintained repository variable or preflight output. Please adjust the regression to validate allowed contexts and coverage of every setup step, rather than matching the secret expression in the job condition.

@wesleyhawes wesleyhawes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The workflow validation blocker remains at this head. I also ran all four new Python tests against this exact workflow: they pass despite the invalid expression, because they check for the guard's text rather than validating its allowed context. Please replace the condition with a supported guard and include workflow validation in the regression checks. The earlier review includes a step-guard alternative that passes actionlint. Prepared with AI assistance.

jobs:
rebase:
if: github.event_name != 'schedule' || github.repository == 'obs-rust/obs-studio'
if: >-

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] secrets is unavailable in jobs.<job_id>.if, so this condition makes the workflow invalid instead of skipping an unconfigured job. actionlint 1.7.11 reports context "secrets" is not allowed here at 41:92. GitHub lists only github, needs, vars and inputs for this position in its context availability table. Keep the fork guard here and use a supported preflight or step-level guard; a boolean job environment flag must guard every setup/execution step, including checkout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants