Skip to content

feat: disable destination GitHub Actions when enabled - #20

Merged
vmvarela merged 3 commits into
masterfrom
feat/19-disable-destination-actions
Oct 24, 2026
Merged

vmvarela merged 3 commits into
masterfrom
feat/19-disable-destination-actions

Conversation

@vmvarela

@vmvarela vmvarela commented Oct 24, 2026 •

Copy link
Copy Markdown
Owner

What

When the destination reports GitHub Actions enabled, gh replicate disables them right before pushing the refs, so the commits it publishes cannot start a workflow there.

The check reuses the existing GET /repos/{owner}/{repo}/actions/permissions: an enabled answer is followed by PUT with {"enabled": false}. Outcomes:

  • already disabled: nothing to do, no request written;
  • disabled now: Disabled GitHub Actions in <destination> for a passive mirror.;
  • unreadable or rejected: a warning with the manual path, and replication continues.

This is the same administration permission that changing the default branch needs.

Why

Replicating a repository pushes its workflow files. With Actions enabled the destination starts those workflows, which surprised us in practice: a mirror produced a draft release the source did not have. Since the destination of a replication is normally a passive mirror, disabling Actions is the correct default.

How tested

  • TestDisableDestinationActions covers enabled (asserts the PUT body carries enabled: false), already disabled, unreadable setting, and rejected update.
  • TestRunReplicatesIntoDestination runs the entrypoint with Actions enabled and requires exactly one update with enabled: false.
  • TestRunDryRunLeavesDestinationUntouched asserts the dry run reports Would PUT .../actions/permissions and sends nothing.
  • TestRunLeavesDestinationUntouchedWhenPreflightFails serves Actions enabled and still sees only GET requests, proving the update cannot happen before validation.
  • go test -race -count=1 ./..., gofmt, go vet, go build, git diff --check all clean.

Known limit

  • The update needs administration write; without it the run warns and continues, and workflows can start.
  • Disabling is permanent: the tool never re-enables Actions, and disabling a repository-wide setting affects every workflow, including those on destination-only branches.
  • Runs already in progress are not cancelled; workflows triggered by an external CI or a webhook are out of reach.

Out of scope

Cancelling running jobs, re-enabling Actions, disabling individual workflows, external CI, and any other repository setting.

Closes #19

@vmvarela
vmvarela force-pushed the feat/19-disable-destination-actions branch from 186624d to 7f84cff Compare October 24, 2026 11:44
@vmvarela
vmvarela merged commit 116bb70 into master Oct 24, 2026
9 checks passed
@vmvarela
vmvarela deleted the feat/19-disable-destination-actions branch October 24, 2026 11:46
@vmvarela vmvarela added the enhancement New feature or request label Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable GitHub Actions in the destination when they are enabled

1 participant