Skip to content

fix: defensive cleanup of release-doc-sync workspace checkout (v1.8.2)#21

Merged
TMHSDigital merged 1 commit intomainfrom
fix/release-doc-sync-cleanup
Apr 25, 2026
Merged

fix: defensive cleanup of release-doc-sync workspace checkout (v1.8.2)#21
TMHSDigital merged 1 commit intomainfrom
fix/release-doc-sync-cleanup

Conversation

@TMHSDigital
Copy link
Copy Markdown
Owner

Why v1.8.2 (and not just v1.8.1)

PR #20 shipped v1.8.1 attempting to fix the .release-doc-sync gitlink pollution bug by moving the meta-repo checkout to ${{ runner.temp }}/release-doc-sync. That fix did not work: actions/checkout@v5 enforces that path: must resolve under GITHUB_WORKSPACE, and rejects out-of-tree paths with:

##[error]Repository path '/home/runner/work/_temp/release-doc-sync' is not under '/home/runner/work/Docker-Developer-Tools/Docker-Developer-Tools'

This was caught immediately when the Docker cleanup PR (Docker#27) triggered Docker's release.yml. Steps 1-7 (bump version) succeeded, step 8 (Sync release docs) failed at checkout, and steps 9-10 (commit + tag) were skipped — so v1.8.1 didn't pollute Docker, it just broke the action entirely. Run: https://github.com/TMHSDigital/Docker-Developer-Tools/actions/runs/24933696416

What v1.8.2 does

Keeps the in-workspace checkout (idiomatic, supported by actions/checkout@v5) and adds a defensive cleanup step:

- name: Clean up workspace checkout
  if: always()
  shell: bash
  run: |
    rm -rf "${{ github.workspace }}/.release-doc-sync"

The cleanup step runs INSIDE the action, before control returns to the caller. The caller's release.yml git add -A (the next step in the calling workflow) then sees nothing to add. if: always() guarantees cleanup even if sync.py exits non-zero.

Regression test

Replaces the v1.8.1 guard (test_meta_repo_checkout_is_outside_workspace, which was asserting an unenforceable constraint) with test_workspace_checkout_is_cleaned_up_before_action_returns. The new test asserts:

  1. A cleanup step exists with if: always().
  2. The cleanup rm -rfs a path matching the checkout step's path: value.
  3. The cleanup step is positioned AFTER the run step (otherwise it cleans before the script can use the checkout).
  4. The cleanup run: references ${{ github.workspace }} to scope the deletion explicitly.

Sanity-verified on my workstation: the test fails with a clear message if the cleanup step is removed.

VERSION

1.8.1 → 1.8.2 (PATCH; bug fix, replaces a non-functional fix with a working one).

After merge, the v1.0 floating tag will be force-updated from v1.8.1 → v1.8.2 so consumers automatically get the working version.

Refs TMHSDigital/Developer-Tools-Directory#5.

v1.8.0 leaked a `.release-doc-sync` directory into caller release commits
as a 160000-mode gitlink (caller's `git add -A` picked up the meta-repo
checkout the action created via actions/checkout).

v1.8.1 attempted to fix this by checking out to ${{ runner.temp }}, but
actions/checkout@v5 enforces that `path:` resolves under GITHUB_WORKSPACE
and rejects out-of-tree paths with "Repository path '...' is not under
'...'" - so v1.8.1 broke the action entirely (caught immediately when
the Phase 2b cleanup commit triggered Docker's release.yml: bump
succeeded, sync failed, commit + tag steps were skipped).

This v1.8.2 ships the actually-working fix: keep the in-workspace
checkout (idiomatic actions/checkout) but add an `if: always()` cleanup
step that runs `rm -rf` on `.release-doc-sync` before control returns to
the caller. The caller's `git add -A` then sees nothing to add.

Regression test (`test_workspace_checkout_is_cleaned_up_before_action_returns`)
asserts:
  - a cleanup step exists with `if: always()`
  - the cleanup `rm -rf`s a path matching the checkout path
  - the cleanup is positioned AFTER the run step
  - the cleanup is scoped via ${{ github.workspace }}
Sanity-verified to fail loudly if any constraint is dropped.

The previous `test_meta_repo_checkout_is_outside_workspace` (v1.8.1's
guard, which asserted `runner.temp`) is replaced; that constraint was
unenforceable because actions/checkout rejects it.

Refs #5.

Signed-off-by: 154358121+TMHSDigital@users.noreply.github.com
Made-with: Cursor
@github-actions github-actions Bot added the ci label Apr 25, 2026
@github-actions
Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@TMHSDigital TMHSDigital merged commit 9e2a6c9 into main Apr 25, 2026
13 checks passed
@TMHSDigital TMHSDigital deleted the fix/release-doc-sync-cleanup branch April 25, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant