Repository navigation
93 lines (90 loc) · 4.04 KB
/
Copy pathmaintain-shadow.yml
File metadata and controls
93 lines (90 loc) · 4.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# A shadow of the pass for agentic-job (tracker#1356, step 1): `agent-board
# poll --dry-run` on agentic-job alone, with pass.json's operator, bot, dispatch,
# assignHolds and openPrCap settings and its `pr` policy except the `maintainers`
# handover, cut to agentic-job (`just maintain-shadow-config`). It takes
# no step and writes only its job summary, to be compared with what the pass
# (poll.yml) actually did there. With repository variable MAINTAIN_SHADOW
# `enabled`, poll.yml's `next` starts it when its newest default-branch run
# is at least thirty minutes old or absent; the cron is the fallback.
name: maintain-shadow
on:
schedule:
- cron: '13,43 * * * *'
workflow_dispatch:
permissions: {}
# The same agent-board commit as poll.yml; agent-board-pin.yml moves both.
env:
AGENT_BOARD_REV: 183ed445b9b0b7b5510454e03e794a31c0efbb5d
FOLLOW: cgwalters-forge/agentic-job
jobs:
preview:
if: ${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
# The state file is read and saved once a run, so runs never overlap.
concurrency:
group: maintain-shadow
cancel-in-progress: false
runs-on: ubuntu-26.04
timeout-minutes: 30
# `actions: read` for the fix runs in dispatchRepo, this repository,
# that the poll's markers name.
permissions:
contents: read
actions: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
# A GitHub release outage (504s for over an hour on 2026-11-08) must not
# stop the job: build the same just from crates.io instead.
- id: just
continue-on-error: true
uses: extractions/setup-just@53165ef7e734c5c07cb06b3c8e7b647c5aa16db3 # v4.0.0
with:
just-version: 1.58.0
- if: steps.just.outcome == 'failure'
run: cargo install --locked --version 1.58.0 just && echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: Install verified agent-board
env:
GH_TOKEN: ${{ github.token }}
timeout-minutes: 10
run: just build-agent-board "$AGENT_BOARD_REV"
# The poll's conditional GETs and cursors. Any job in main's cache scope,
# pull_request_target and issue_comment runs included, could write a
# maintain-shadow- entry and falsify the preview; a dry run with a
# read-only token can afford that, an applying poll could not.
- name: Restore the poll state
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/poll-state.json
key: maintain-shadow-${{ github.run_id }}
restore-keys: maintain-shadow-
- name: Configuration
run: just maintain-shadow-config .github/pass.json "$FOLLOW" > "$RUNNER_TEMP/agent-board.json"
- name: Preview
id: preview
timeout-minutes: 15
env:
# Read-only: a dry run needs no write, so it is never given the bot's.
GH_TOKEN: ${{ github.token }}
AGENT_BOARD: ${{ runner.temp }}/agent-board/bin/agent-board
shell: bash
run: |
"$AGENT_BOARD" poll --dry-run --config "$RUNNER_TEMP/agent-board.json" \
--state "$RUNNER_TEMP/poll-state.json" --follow "$FOLLOW" \
--fix-bounds .github/agentic-job/fix.toml \
--fix-bounds .github/agentic-job/midstream-fix.toml 2>&1 | tee "$RUNNER_TEMP/poll.log"
- name: Save the poll state
if: ${{ !cancelled() && steps.preview.outcome != 'skipped' }}
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ runner.temp }}/poll-state.json
key: maintain-shadow-${{ github.run_id }}
- name: Summary
if: ${{ !cancelled() }}
run: |
{
echo "### Shadow poll of $FOLLOW (dry run)"
echo '<pre>'
sed 's/&/\&/g; s/</\</g; s/>/\>/g' "$RUNNER_TEMP/poll.log" 2>/dev/null || echo 'No poll ran'
echo '</pre>'
} >> "$GITHUB_STEP_SUMMARY"