Skip to content

fix(ci): repair auto-compress-manage — real SHA pins + 4 skip conditions - #243

Merged
zyntromedia merged 1 commit into
mainfrom
fig/auto-compress-skip-conditions
Sep 13, 2026
Merged

zyntromedia merged 1 commit into
mainfrom
fig/auto-compress-skip-conditions

Conversation

@fig-ai-agent

@fig-ai-agent fig-ai-agent Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

What

แก้ .github/workflows/auto-compress-manage.yml — เติม Skip Conditions ครบ 4 ข้อตามสเปค
และซ่อม action ref ที่ทำให้ workflow ล้มทุก run

ไฟล์ปลายทาง: deliverables/ci/auto-compress-manage.yml.github/workflows/auto-compress-manage.yml

Why (ตัว blocker ที่เจอก่อน)

Workflow นี้ ล้มทุก run (781 runs, ล่าสุด #779) ตั้งแต่ระดับ Set up job:

An action could not be found at the URI 'https://api.github.com/repos/...'
unable to find version

สาเหตุ: action ref 5 ตัวชี้ไปยัง SHA ที่ ไม่มีอยู่จริง ใน upstream repo —
ยืนยันแล้วด้วย commit API (No commit found for SHA)

เดิม (พัง) ใหม่ (verify แล้ว)
calibreapp/image-actions@8c44b87c… 26d5b54006db…
peter-evans/create-pull-request@a5e986b9… 22a9089034f4…
stefh/ghaction-CompressFiles@9c8a7d6e… 7abba5ba5b3c…
actions/checkout@f548e57c… 11d5960a3267…
actions/upload-artifact@65462800… ea165f8d65b6…

ถ้าเติมแค่ skip conditions โดยไม่แก้ ref นี้ workflow ก็ยังล้มอยู่ดี

Skip Conditions

# เงื่อนไข ผล
1 on.paths (7 globs) commit ที่ไม่แตะไฟล์ภาพ/เว็บ ข้ามทั้ง workflow — ไม่ต้องรัน scan
2 bot-loop guard scan ข้าม branch auto/* และ commit ที่มี [skip ci]
3 inputs.target compress-images / compress-web เคารพ dropdown ของ workflow_dispatch
4 summary ข้ามเมื่อทั้ง 2 job ถูก skip

3 จุดที่จงใจต่างจากสเปค

  1. **.jpg**/*.jpg — glob เดิมไม่ใช่ syntax ของ GitHub และใน YAML **.jpg
    ทำให้ไฟล์ parse ไม่ผ่านทั้งไฟล์ ต้องมี / คั่น
  2. เพิ่ม head_ref ใน bot guard — ตอน pull_request event github.ref คือ
    refs/pull/N/merge ไม่ใช่ refs/heads/... ถ้าเช็คแค่ github.ref guard จะไม่ทำงานเลยบน PR
    เพิ่ม !startsWith(github.head_ref || '', 'auto/') — และต้องมี || '' เพราะ push event
    ไม่มี head_ref (ไม่งั้นเงื่อนไขกลายเป็น null ทั้งอัน)
  3. compression-level: 0 บน upload-artifact.br/.gz ถูกบีบอัดมาแล้ว บีบอัดซ้ำไม่มีประโยชน์

เพิ่ม artifacts ในตัวเลือก target ให้ตรงกับเอกสาร (ปุ่มเดิมมี 3 ตัวเลือก และไม่มี job ไหนใช้ค่านี้เลย)

Verification

python3 deliverables/ci/validate_acm_workflow.py deliverables/ci/auto-compress-manage.yml

26/26 checks passed — YAML parse, duplicate keys, glob ทั้ง 7, bot guard ทั้ง 3 เงื่อนไข,
inputs.target, summary, SHA-pin ครบ และยิง commit API ยืนยันว่า SHA ทุกตัว resolve จริง

ทำไมอยู่ใน deliverables/

App fig-ai-agent ไม่มี workflows permission — push เข้า .github/workflows/ ตรงๆ
ถูกปฏิเสธ (refusing to allow a GitHub App to create or update workflow)

เลือกทางใดทางหนึ่ง:

  1. merge PR นี้ แล้วย้ายไฟล์ด้วยมือ deliverables/ci/auto-compress-manage.yml.github/workflows/auto-compress-manage.yml
    (commit เดียว ไม่ต้องแก้เนื้อหา)
  2. ให้ fig-ai-agent สิทธิ์ workflows แล้วผม push เข้า .github/workflows/ ให้ตรงๆ

PR นี้ยังไม่แก้ workflow ที่รันจริง จนกว่าจะย้ายไฟล์ในข้อ 1

Note

CI ของ PR นี้แดงจาก policy SHA-pin ใน ci.yml ที่มีอยู่ก่อนแล้วบน main — ไม่เกี่ยวกับ diff นี้

Supersedes #242 (draft, ปิดได้)

…p conditions

The workflow on main failed all 781 runs: five action refs point at commit SHAs
that do not exist upstream (Set up job -> "unable to find version"). Replaced
with SHAs verified against the commit API.

Implements the four documented skip conditions:
  1. on.paths trigger filters (images + web assets)
  2. bot-loop guard on scan — github.ref AND github.head_ref, null-safe
  3. inputs.target gating on compress-images / compress-web
  4. summary skips when both children are skipped

Three intentional deviations from the original spec, each noted in the README:
  - '**/*.ext' instead of '**.ext' (the latter is YAML-invalid, not a GitHub glob)
  - head_ref added to the bot guard (github.ref is refs/pull/N/merge on PRs)
  - compression-level: 0 on upload-artifact (payload is already compressed)

Ships to deliverables/ci/ because the GitHub App lacks the workflows permission
to write .github/workflows/ directly. Includes a 26-check validator.
@zyntromedia
zyntromedia merged commit a56782f into main Sep 13, 2026
8 of 14 checks passed
@zyntromedia
zyntromedia deleted the fig/auto-compress-skip-conditions branch September 13, 2026 15:21
zyntromedia pushed a commit that referenced this pull request Sep 13, 2026
Four PRs merged on 2026-09-13 were absent from the changelog. Placed in the
existing [2026-09-13] section, in the file's own order (PR number descending
within each subsection).

- **#245** (Added) — knowledge notes gained an index, a manifest and front
  matter, plus sync_knowledge_index.py to derive the index from the notes
- **#240** (Added) — ci-workflow-authoring skill and lint.py; it flagged 9 of
  the 10 workflows then on main, all for the same unresolvable-ref reason
- **#236** (Changed) — README rewritten to describe the tree as it stands
- **#243** (Fixed) — auto-compress-manage.yml, failing at `Set up job` on all
  781 runs: five action refs pointed at SHAs that do not exist upstream

#239 is deliberately not recorded: it is a changelog PR, and this repository
does not log its own changelog PRs (zero such entries exist).

Surgical anchored inserts, not a regeneration — the file is 370 lines of
hand-written prose and rewriting it would lose formatting and drop entries.
43 insertions, 0 deletions; date sections unchanged (6), per-subsection PR
numbers verified descending, no duplicate PR refs introduced.

Co-authored-by: Fig AI Agent <fig-ai-agent@users.noreply.github.com>
@fig-ai-agent fig-ai-agent Bot mentioned this pull request Sep 14, 2026
7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant