Skip to content
Merged
2 changes: 1 addition & 1 deletion actions/setup/js/restore_aic_usage_cache_fallback.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
/**
* restore_aic_usage_cache_fallback.cjs
*
* Called from the activation job when actions/cache/restore has a cache miss.
* Called from the activation job only when actions/cache/restore reports a cache miss.
* Downloads the most recent `aic-usage-cache` artifact from the same workflow's
* recent runs to populate the local cache file without requiring the artifact to
* have been saved on the current branch.
Expand Down
18 changes: 17 additions & 1 deletion pkg/workflow/compiler_activation_job_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,22 @@ func (c *Compiler) buildActivationDailyAICGuardrailStep(data *WorkflowData) []st
steps = append(steps, fmt.Sprintf(" key: %s${{ github.run_id }}\n", cacheKeyPrefix))
steps = append(steps, fmt.Sprintf(" restore-keys: %s\n", cacheKeyPrefix))
steps = append(steps, " path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl\n")
// Detect true cache misses while accounting for branch-scoped action caches.
// The primary key includes run_id, so exact hits are not expected across runs.
// We treat a restore as a hit when cache-matched-key is present, and as a miss
// when no matched key is available.
steps = append(steps, " - name: Detect daily AIC usage cache miss\n")
steps = append(steps, " id: detect-daily-aic-cache-miss\n")
steps = append(steps, fmt.Sprintf(" if: %s\n", maxDailyAICreditsConfiguredIfExpr))

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.

[/diagnose] The detect step has no continue-on-error: true, unlike the surrounding restore and fallback steps. If writing to $GITHUB_OUTPUT ever fails (unwritable path, runner misconfiguration), the job dies here — cache_miss output is never set, the fallback silently does not run, and the cache stays unpopulated on a confirmed miss.

💡 Suggested fix

Add continue-on-error: true to stay consistent with the restore step and keep the guardrail flow robust:

steps = append(steps, "      - name: Detect daily AIC usage cache miss\n")
steps = append(steps, "        id: detect-daily-aic-cache-miss\n")
steps = append(steps, fmt.Sprintf("        if: %s\n", maxDailyAICreditsConfiguredIfExpr))
steps = append(steps, "        continue-on-error: true\n")  // defensive — same pattern as restore step

If the step still fails despite continue-on-error, cache_miss remains unset and the fallback condition cache_miss == 'true' evaluates to false — no worse than today's pre-PR behaviour.

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.

Missing continue-on-error: true on the detect step introduces a new guardrail bypass path: if this shell step exits non-zero, GitHub Actions skips all subsequent steps that lack an explicit always() guard — including Check daily workflow token guardrail.

💡 Failure mechanism and fix

The detect-daily-aic-cache-miss step has no continue-on-error: true. The downstream guardrail check step is:

if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}

This contains no always() / failure() function, so GitHub Actions implicitly requires success() before evaluating it. A failure in the detect step therefore silently bypasses the AIC-usage enforcement.

The shell script is simple enough that failures are unlikely on GitHub-hosted runners, but $GITHUB_OUTPUT write errors, runner misconfiguration, or shell path issues on self-hosted runners can trigger this path.

Fix — add continue-on-error: true consistent with the sibling fallback step, or append || true to guarantee the step always exits 0:

steps = append(steps, "        id: detect-daily-aic-cache-miss\n")
steps = append(steps, "        continue-on-error: true\n")  // add this
steps = append(steps, fmt.Sprintf("        if: %s\n", maxDailyAICreditsConfiguredIfExpr))

steps = append(steps, " env:\n")
steps = append(steps, " GH_AW_RESTORE_DAILY_AIC_CACHE_HIT: ${{ steps.restore-daily-aic-cache.outputs.cache-hit }}\n")
steps = append(steps, " GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY: ${{ steps.restore-daily-aic-cache.outputs.cache-matched-key }}\n")
steps = append(steps, " run: |\n")
steps = append(steps, " if [ -z \"$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT\" ] || { [ \"$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT\" = \"false\" ] && [ -z \"$GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY\" ]; }; then\n")
steps = append(steps, " echo \"cache_miss=true\" >> \"$GITHUB_OUTPUT\"\n")
steps = append(steps, " else\n")
steps = append(steps, " echo \"cache_miss=false\" >> \"$GITHUB_OUTPUT\"\n")
steps = append(steps, " fi\n")
// Artifact-based fallback for cross-branch cache misses.
// GitHub Actions actions/cache is branch-scoped: caches written by the conclusion job
// on one PR branch are invisible to the activation job running on a different PR branch.
Expand All @@ -353,7 +369,7 @@ func (c *Compiler) buildActivationDailyAICGuardrailStep(data *WorkflowData) []st
// The fallback script is a no-op when the cache file already exists.
steps = append(steps, " - name: Restore daily AIC usage cache (artifact fallback)\n")
steps = append(steps, " id: restore-daily-aic-cache-fallback\n")
steps = append(steps, fmt.Sprintf(" if: %s\n", maxDailyAICreditsConfiguredIfExpr))
steps = append(steps, fmt.Sprintf(" if: %s && steps.detect-daily-aic-cache-miss.outputs.cache_miss == 'true'\n", maxDailyAICreditsConfiguredIfExpr))
Comment thread
Copilot marked this conversation as resolved.
Outdated

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.

[/zoom-out] The fallback if: mixes ${{ expr }} template syntax (from maxDailyAICreditsConfiguredIfExpr) with a bare expression appended outside the closing }}. This works today because GitHub Actions evaluates if: in expression context, but it creates a fragile coupling: if maxDailyAICreditsConfiguredIfExpr is ever refactored to drop the ${{ }} wrapper, the conjunction silently breaks.

💡 Suggestion

Consider consolidating both conditions inside a single ${{ }} block, or introduce a combinator helper (e.g. withMaxDailyAICreditsCondition(extra string) string) that wraps the conjunction consistently. This keeps the contract explicit and removes the dependency on the outer string's ${{ }} wrapping.

steps = append(steps, " continue-on-error: true\n")
steps = append(steps, fmt.Sprintf(" uses: %s\n", getCachedActionPin("actions/github-script", data)))
steps = append(steps, " with:\n")
Expand Down
15 changes: 15 additions & 0 deletions pkg/workflow/daily_aic_workflow_guardrail_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,21 @@ Guardrail test workflow`
if !strings.Contains(activationSection, "id: restore-daily-aic-cache-fallback") {
t.Fatal("expected activation job to include the artifact-based AIC cache fallback step")
}
if !strings.Contains(activationSection, "id: detect-daily-aic-cache-miss") {

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.

[/tdd] strings.Contains confirms the step exists but not that it appears before restore-daily-aic-cache-fallback. If the step order were reversed by a future refactor, the fallback step's if: expression would reference outputs from a skipped or not-yet-run step, silently making the fallback a no-op.

💡 Suggested guard
detectIdx := strings.Index(activationSection, "id: detect-daily-aic-cache-miss")
fallbackIdx := strings.Index(activationSection, "id: restore-daily-aic-cache-fallback")
if detectIdx == -1 || fallbackIdx == -1 || detectIdx >= fallbackIdx {
    t.Fatal("expected detect-daily-aic-cache-miss to appear before restore-daily-aic-cache-fallback")
}

The golden tests already verify ordering indirectly, but a direct assertion here makes the invariant explicit and fails fast with a descriptive message.

t.Fatal("expected activation job to include a cache-miss detection step before fallback")
}
if !strings.Contains(activationSection, "GH_AW_RESTORE_DAILY_AIC_CACHE_HIT: ${{ steps.restore-daily-aic-cache.outputs.cache-hit }}") {
t.Fatal("expected cache-miss detection to pass cache-hit output via env for template-injection safety")
}
if !strings.Contains(activationSection, "GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY: ${{ steps.restore-daily-aic-cache.outputs.cache-matched-key }}") {
t.Fatal("expected cache-miss detection to pass cache-matched-key output via env")
}
if !strings.Contains(activationSection, `if [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" ] || { [ "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" = "false" ] && [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY" ]; }; then`) {

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.

[/tdd] The test verifies that the shell predicate string is present, but doesn't exercise its four distinct cases. The restore-key-hit case (cache-hit=false + cache-matched-key set) is the exact scenario this PR fixes — it should have an explicit assertion or a shell-level test to prevent regressions.

💡 Missing cases to cover
cache-hit cache-matched-key Expected cache_miss Notes
"" "" true Step skipped / runner error
"false" "" true True miss
"false" "agentic-workflow-...-123" false Restore-key hit — the original bug
"true" "agentic-workflow-...-123" false Exact hit

A table-driven shell test (or even a small TestCacheMissDetectionLogic that shells out with controlled env vars) would lock in correctness and serve as living documentation for the detection semantics.

t.Fatal("expected cache-miss detection to treat missing matched key as a true miss")
}
if !strings.Contains(activationSection, "steps.detect-daily-aic-cache-miss.outputs.cache_miss == 'true'") {

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.

Substring-only assertion does not validate the expression form: this test passes even when the if: condition contains the broken mixed-${{ }} syntax, providing false coverage confidence.

💡 Why it matters and a stronger alternative

The current check confirms the fragment steps.detect-daily-aic-cache-miss.outputs.cache_miss == 'true' is present somewhere in the output. The Go source currently emits:

if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }} && steps.detect-daily-aic-cache-miss.outputs.cache_miss == 'true'

That line contains the substring, so this test passes — even though the generated YAML is invalid.

A stronger assertion verifies the complete, well-formed if: line:

// Check the entire if: line on the fallback step is a properly formed bare expression
wantFallbackIf := "if: env.GH_AW_MAX_DAILY_AI_CREDITS != '' && steps.detect-daily-aic-cache-miss.outputs.cache_miss == 'true'"
if !strings.Contains(activationSection, wantFallbackIf) {
    t.Fatalf("expected fallback step if: to use a well-formed bare expression, got activation section:\n%s", activationSection)
}

Without this, the ${{ }} wrapping defect is invisible to the test suite.

t.Fatal("expected artifact fallback step to run only when cache-miss detection reports a miss")
}
if !strings.Contains(lockStr, "id: upload-daily-aic-cache") {
t.Fatal("expected conclusion job to include the AIC usage cache artifact upload step")
}
Expand Down
14 changes: 13 additions & 1 deletion pkg/workflow/testdata/TestWasmGolden_AllEngines/claude.golden
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,21 @@ jobs:
key: agentic-workflow-usage-workflow-${{ github.run_id }}
restore-keys: agentic-workflow-usage-workflow-
path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl
- name: Detect daily AIC usage cache miss
id: detect-daily-aic-cache-miss
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
env:
GH_AW_RESTORE_DAILY_AIC_CACHE_HIT: ${{ steps.restore-daily-aic-cache.outputs.cache-hit }}
GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY: ${{ steps.restore-daily-aic-cache.outputs.cache-matched-key }}
run: |
if [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" ] || { [ "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" = "false" ] && [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY" ]; }; then
echo "cache_miss=true" >> "$GITHUB_OUTPUT"
else
echo "cache_miss=false" >> "$GITHUB_OUTPUT"
fi
- name: Restore daily AIC usage cache (artifact fallback)
id: restore-daily-aic-cache-fallback
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }} && steps.detect-daily-aic-cache-miss.outputs.cache_miss == 'true'
continue-on-error: true
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
Expand Down
14 changes: 13 additions & 1 deletion pkg/workflow/testdata/TestWasmGolden_AllEngines/codex.golden
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,21 @@ jobs:
key: agentic-workflow-usage-workflow-${{ github.run_id }}
restore-keys: agentic-workflow-usage-workflow-
path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl
- name: Detect daily AIC usage cache miss
id: detect-daily-aic-cache-miss
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
env:
GH_AW_RESTORE_DAILY_AIC_CACHE_HIT: ${{ steps.restore-daily-aic-cache.outputs.cache-hit }}
GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY: ${{ steps.restore-daily-aic-cache.outputs.cache-matched-key }}
run: |
if [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" ] || { [ "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" = "false" ] && [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY" ]; }; then
echo "cache_miss=true" >> "$GITHUB_OUTPUT"
else
echo "cache_miss=false" >> "$GITHUB_OUTPUT"
fi
- name: Restore daily AIC usage cache (artifact fallback)
id: restore-daily-aic-cache-fallback
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }} && steps.detect-daily-aic-cache-miss.outputs.cache_miss == 'true'
continue-on-error: true
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
Expand Down
14 changes: 13 additions & 1 deletion pkg/workflow/testdata/TestWasmGolden_AllEngines/copilot.golden
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,21 @@ jobs:
key: agentic-workflow-usage-workflow-${{ github.run_id }}
restore-keys: agentic-workflow-usage-workflow-
path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl
- name: Detect daily AIC usage cache miss
id: detect-daily-aic-cache-miss
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
env:
GH_AW_RESTORE_DAILY_AIC_CACHE_HIT: ${{ steps.restore-daily-aic-cache.outputs.cache-hit }}
GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY: ${{ steps.restore-daily-aic-cache.outputs.cache-matched-key }}
run: |
if [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" ] || { [ "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" = "false" ] && [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY" ]; }; then
echo "cache_miss=true" >> "$GITHUB_OUTPUT"
else
echo "cache_miss=false" >> "$GITHUB_OUTPUT"
fi
- name: Restore daily AIC usage cache (artifact fallback)
id: restore-daily-aic-cache-fallback
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }} && steps.detect-daily-aic-cache-miss.outputs.cache_miss == 'true'

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.

Broken if: expression is canonicalized into all 10 golden snapshots: this is the artifact that gets shipped to user workflows, and it now carries the invalid ${{ ... }} && bare-expr syntax that the other inline comment flags in the Go source.

💡 Impact and required fix

Every updated golden file now contains:

if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }} && steps.detect-daily-aic-cache-miss.outputs.cache_miss == 'true'

GitHub Actions resolves ${{ }} fragments into string tokens first (true/false), then re-parses the remaining text as an expression. Whether the result of "true" && some-expr is treated as a truthy string coercion or as a proper boolean is undocumented and has differed across runner versions. The correct fixes are either:

# Option A – single ${{ }} wrapping the entire expression
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' && steps.detect-daily-aic-cache-miss.outputs.cache_miss == 'true' }}

# Option B – fully bare (no ${{ }} wrapper at all)
if: env.GH_AW_MAX_DAILY_AI_CREDITS != '' && steps.detect-daily-aic-cache-miss.outputs.cache_miss == 'true'

The golden files need to be regenerated after the Go-source fix (make recompile) or the next compilation run will re-bless the broken YAML.

continue-on-error: true
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
Expand Down
14 changes: 13 additions & 1 deletion pkg/workflow/testdata/TestWasmGolden_AllEngines/gemini.golden
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,21 @@ jobs:
key: agentic-workflow-usage-workflow-${{ github.run_id }}
restore-keys: agentic-workflow-usage-workflow-
path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl
- name: Detect daily AIC usage cache miss
id: detect-daily-aic-cache-miss
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
env:
GH_AW_RESTORE_DAILY_AIC_CACHE_HIT: ${{ steps.restore-daily-aic-cache.outputs.cache-hit }}
GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY: ${{ steps.restore-daily-aic-cache.outputs.cache-matched-key }}
run: |
if [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" ] || { [ "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" = "false" ] && [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY" ]; }; then
echo "cache_miss=true" >> "$GITHUB_OUTPUT"
else
echo "cache_miss=false" >> "$GITHUB_OUTPUT"
fi
- name: Restore daily AIC usage cache (artifact fallback)
id: restore-daily-aic-cache-fallback
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }} && steps.detect-daily-aic-cache-miss.outputs.cache_miss == 'true'
continue-on-error: true
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
Expand Down
14 changes: 13 additions & 1 deletion pkg/workflow/testdata/TestWasmGolden_AllEngines/pi.golden
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,21 @@ jobs:
key: agentic-workflow-usage-workflow-${{ github.run_id }}
restore-keys: agentic-workflow-usage-workflow-
path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl
- name: Detect daily AIC usage cache miss
id: detect-daily-aic-cache-miss
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
env:
GH_AW_RESTORE_DAILY_AIC_CACHE_HIT: ${{ steps.restore-daily-aic-cache.outputs.cache-hit }}
GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY: ${{ steps.restore-daily-aic-cache.outputs.cache-matched-key }}
run: |
if [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" ] || { [ "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" = "false" ] && [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY" ]; }; then
echo "cache_miss=true" >> "$GITHUB_OUTPUT"
else
echo "cache_miss=false" >> "$GITHUB_OUTPUT"
fi
- name: Restore daily AIC usage cache (artifact fallback)
id: restore-daily-aic-cache-fallback
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }} && steps.detect-daily-aic-cache-miss.outputs.cache_miss == 'true'
continue-on-error: true
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,21 @@ jobs:
key: agentic-workflow-usage-basiccopilot-${{ github.run_id }}
restore-keys: agentic-workflow-usage-basiccopilot-
path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl
- name: Detect daily AIC usage cache miss
id: detect-daily-aic-cache-miss
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
env:
GH_AW_RESTORE_DAILY_AIC_CACHE_HIT: ${{ steps.restore-daily-aic-cache.outputs.cache-hit }}
GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY: ${{ steps.restore-daily-aic-cache.outputs.cache-matched-key }}
run: |
if [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" ] || { [ "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" = "false" ] && [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY" ]; }; then
echo "cache_miss=true" >> "$GITHUB_OUTPUT"
else
echo "cache_miss=false" >> "$GITHUB_OUTPUT"
fi
- name: Restore daily AIC usage cache (artifact fallback)
id: restore-daily-aic-cache-fallback
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }} && steps.detect-daily-aic-cache-miss.outputs.cache_miss == 'true'
continue-on-error: true
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,21 @@ jobs:
key: agentic-workflow-usage-playwrightclimode-${{ github.run_id }}
restore-keys: agentic-workflow-usage-playwrightclimode-
path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl
- name: Detect daily AIC usage cache miss
id: detect-daily-aic-cache-miss
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
env:
GH_AW_RESTORE_DAILY_AIC_CACHE_HIT: ${{ steps.restore-daily-aic-cache.outputs.cache-hit }}
GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY: ${{ steps.restore-daily-aic-cache.outputs.cache-matched-key }}
run: |
if [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" ] || { [ "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" = "false" ] && [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY" ]; }; then
echo "cache_miss=true" >> "$GITHUB_OUTPUT"
else
echo "cache_miss=false" >> "$GITHUB_OUTPUT"
fi
- name: Restore daily AIC usage cache (artifact fallback)
id: restore-daily-aic-cache-fallback
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }} && steps.detect-daily-aic-cache-miss.outputs.cache_miss == 'true'
continue-on-error: true
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,21 @@ jobs:
key: agentic-workflow-usage-smokecopilot-${{ github.run_id }}
restore-keys: agentic-workflow-usage-smokecopilot-
path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl
- name: Detect daily AIC usage cache miss
id: detect-daily-aic-cache-miss
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
env:
GH_AW_RESTORE_DAILY_AIC_CACHE_HIT: ${{ steps.restore-daily-aic-cache.outputs.cache-hit }}
GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY: ${{ steps.restore-daily-aic-cache.outputs.cache-matched-key }}
run: |
if [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" ] || { [ "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" = "false" ] && [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY" ]; }; then
echo "cache_miss=true" >> "$GITHUB_OUTPUT"
else
echo "cache_miss=false" >> "$GITHUB_OUTPUT"
fi
- name: Restore daily AIC usage cache (artifact fallback)
id: restore-daily-aic-cache-fallback
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }} && steps.detect-daily-aic-cache-miss.outputs.cache_miss == 'true'
continue-on-error: true
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,21 @@ jobs:
key: agentic-workflow-usage-withimports-${{ github.run_id }}
restore-keys: agentic-workflow-usage-withimports-
path: /tmp/gh-aw/agentic-workflow-usage-cache.jsonl
- name: Detect daily AIC usage cache miss
id: detect-daily-aic-cache-miss
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
env:
GH_AW_RESTORE_DAILY_AIC_CACHE_HIT: ${{ steps.restore-daily-aic-cache.outputs.cache-hit }}
GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY: ${{ steps.restore-daily-aic-cache.outputs.cache-matched-key }}
run: |
if [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" ] || { [ "$GH_AW_RESTORE_DAILY_AIC_CACHE_HIT" = "false" ] && [ -z "$GH_AW_RESTORE_DAILY_AIC_CACHE_MATCHED_KEY" ]; }; then
echo "cache_miss=true" >> "$GITHUB_OUTPUT"
else
echo "cache_miss=false" >> "$GITHUB_OUTPUT"
fi
- name: Restore daily AIC usage cache (artifact fallback)
id: restore-daily-aic-cache-fallback
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }}
if: ${{ env.GH_AW_MAX_DAILY_AI_CREDITS != '' }} && steps.detect-daily-aic-cache-miss.outputs.cache_miss == 'true'
continue-on-error: true
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
Expand Down
Loading