Skip to content

Add fork sync workflow - #1

Open
wickedyoda wants to merge 1 commit into
masterfrom
add/sync-fork-workflow
Open

wickedyoda wants to merge 1 commit into
masterfrom
add/sync-fork-workflow

Conversation

@wickedyoda

Copy link
Copy Markdown

Adds sync-fork.yml workflow to automatically sync this fork from its upstream parent repository daily at 04:00 UTC.

The workflow:

  • Auto-detects the upstream parent repo via GitHub API
  • Fetches and merges upstream changes into the fork's default branch
  • Preserves local .github/workflows/ files (protect_workflows: true by default)
  • Force-pushes the merged result (overwrites fork history with upstream)

Note: Any local changes outside .github/workflows/ will be overwritten during sync.

Copilot AI balanced review requested due to automatic review settings October 13, 2026 16:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Branch handling, workflow preservation, concurrency, and command-injection vulnerabilities must be corrected.

7 open findings
What changed in this PR

Adds a scheduled and manually triggered workflow for synchronizing the fork with its upstream repository.

Changes:

  • Detects the upstream repository and default branch.
  • Supports dry runs, forced synchronization, and workflow preservation.
  • Generates a synchronization summary.
File Description
.github/​workflows/​sync-fork.yml Implements upstream fork synchronization and reporting.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

type: boolean
default: false

jobs:
Comment on lines +55 to +61
env:
OPT_DRY_RUN: ${{ inputs.dry_run || 'false' }}
OPT_PROTECT_WORKFLOWS: ${{ inputs.protect_workflows || 'true' }}
OPT_FORCE_SYNC: ${{ inputs.force_sync || 'false' }}
run: |
PRE_SHA="${{ steps.pre_sync.outputs.sha }}"
BRANCH="${{ steps.upstream.outputs.branch }}"
Comment on lines +70 to +72
if [ "$OPT_FORCE_SYNC" = "true" ]; then
git reset --hard "upstream/$BRANCH"
elif [ "$OPT_PROTECT_WORKFLOWS" = "true" ]; then
id: sync
env:
OPT_DRY_RUN: ${{ inputs.dry_run || 'false' }}
OPT_PROTECT_WORKFLOWS: ${{ inputs.protect_workflows || 'true' }}
env:
OPT_DRY_RUN: ${{ inputs.dry_run || 'false' }}
OPT_PROTECT_WORKFLOWS: ${{ inputs.protect_workflows || 'true' }}
OPT_FORCE_SYNC: ${{ inputs.force_sync || 'false' }}

git remote add upstream "https://github.com/${{ steps.upstream.outputs.repo }}.git"
git fetch upstream
git checkout "$BRANCH"
Comment on lines +81 to +84
if [ "$MERGE_EXIT" -ne 0 ]; then
CONFLICTS=$(git diff --name-only --diff-filter=U)
NON_WORKFLOW_CONFLICTS=$(echo "$CONFLICTS" | grep -vE '^\.github/workflows/' || true)
if [ -n "$NON_WORKFLOW_CONFLICTS" ]; then
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.

2 participants