Skip to content

fix: add force_push and fetch-depth: 0#97

Merged
thedavidweng merged 1 commit into
mainfrom
fix/mirror-v2
Jun 20, 2026
Merged

fix: add force_push and fetch-depth: 0#97
thedavidweng merged 1 commit into
mainfrom
fix/mirror-v2

Conversation

@thedavidweng

Copy link
Copy Markdown
Owner

Fix mirror workflow: force push to overwrite Codeberg, full clone.

@thedavidweng thedavidweng merged commit d4e54ea into main Jun 20, 2026
7 of 9 checks passed
@greptile-apps

greptile-apps Bot commented Jun 20, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes the Codeberg mirror workflow by adding fetch-depth: 0 to the checkout step (required for a full clone of all branches and tags) and attempting to enable force push via force_push: true on the mirror action step.

  • fetch-depth: 0 is the correct and necessary change — the action's own documentation marks this as required for mirroring to work at all.
  • force_push: true is the intended fix for diverged-history failures, but force_push does not appear in the declared inputs of cssnr/mirror-repository-action v1.2.0; GitHub Actions will warn about the unexpected input and silently ignore it, so pushes to Codeberg will still fail whenever the histories have diverged.

Confidence Score: 3/5

Half the fix works (fetch-depth: 0), but the force-push behavior — the primary motivation for this PR — is most likely a no-op because the action does not recognise that input.

The fetch-depth change is correct and needed, but force_push: true is passed to an action that does not declare it as a recognized input. Pushes to Codeberg will still be rejected when histories have diverged, meaning the stated goal of this PR is not actually achieved.

.github/workflows/mirror.yml — specifically the force_push input on the cssnr/mirror-repository-action step needs verification against the action's source action.yml at the pinned SHA.

Important Files Changed

Filename Overview
.github/workflows/mirror.yml Adds fetch-depth: 0 (correct and necessary for full mirroring) and force_push: true to the mirror action, but force_push is not a declared input of cssnr/mirror-repository-action v1.2.0 and will likely be silently ignored, leaving the force-push fix ineffective.

Sequence Diagram

%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
    participant GH as GitHub (push/tag)
    participant Runner as GitHub Actions Runner
    participant Checkout as actions/checkout
    participant Mirror as cssnr/mirror-repository-action
    participant Codeberg as Codeberg Repo

    GH->>Runner: Trigger on push/tag or workflow_dispatch
    Runner->>Checkout: "checkout@v4 (fetch-depth: 0)"
    Checkout-->>Runner: Full clone (all history, branches, tags)
    Runner->>Mirror: mirror-repository-action (host, username, password, force_push: true)
    Note over Mirror: force_push not a declared input — likely ignored
    Mirror->>Codeberg: git push (without --force)
    alt Codeberg history diverged
        Codeberg-->>Mirror: Push rejected
        Mirror-->>Runner: Step fails
    else Histories compatible
        Codeberg-->>Mirror: Push accepted
        Mirror-->>Runner: Success
    end
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
    participant GH as GitHub (push/tag)
    participant Runner as GitHub Actions Runner
    participant Checkout as actions/checkout
    participant Mirror as cssnr/mirror-repository-action
    participant Codeberg as Codeberg Repo

    GH->>Runner: Trigger on push/tag or workflow_dispatch
    Runner->>Checkout: "checkout@v4 (fetch-depth: 0)"
    Checkout-->>Runner: Full clone (all history, branches, tags)
    Runner->>Mirror: mirror-repository-action (host, username, password, force_push: true)
    Note over Mirror: force_push not a declared input — likely ignored
    Mirror->>Codeberg: git push (without --force)
    alt Codeberg history diverged
        Codeberg-->>Mirror: Push rejected
        Mirror-->>Runner: Step fails
    else Histories compatible
        Codeberg-->>Mirror: Push accepted
        Mirror-->>Runner: Success
    end
Loading

Fix All in Claude Code Fix All in Codex Fix All in Cursor

Reviews (1): Last reviewed commit: "fix: add force_push and fetch-depth: 0" | Re-trigger Greptile

host: https://codeberg.org
username: thedavidweng
password: ${{ secrets.CODEBERG_TOKEN }}
force_push: true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 force_push is not a declared input of this action

The GitHub Marketplace listing for cssnr/mirror-repository-action v1.2.0 declares inputs: url, host, owner, repo, create, username, password, summary, and private. force_push is absent from all of them. GitHub Actions will emit a warning about the unexpected input and the parameter will be silently ignored — the push will happen without --force, meaning the original failure (Codeberg history diverged from GitHub) will persist. Verify via the action's source action.yml that force_push is a recognized input at the pinned SHA, or replace this step with a raw git push --force script step.

Fix in Claude Code Fix in Codex Fix in Cursor

fetch-depth: 0

- name: Mirror to Codeberg
uses: cssnr/mirror-repository-action@2af5bf347684245f52b5f56502956a57f9b8813e # v1

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 The inline comment says # v1 but the SHA 2af5bf347684245f52b5f56502956a57f9b8813e corresponds to v1.2.0 (confirmed from the action author's own mirror workflow). Keeping the comment accurate avoids confusion when auditing pinned versions later.

Suggested change
uses: cssnr/mirror-repository-action@2af5bf347684245f52b5f56502956a57f9b8813e # v1
uses: cssnr/mirror-repository-action@2af5bf347684245f52b5f56502956a57f9b8813e # v1.2.0

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Codex Fix in Cursor

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