Skip to content

Commit 5889d84

Browse files
TooTallNateCopilot
andauthored
ci: auto-resolve skills/ conflicts in backport to stable (#1798)
* ci: auto-resolve skills/ conflicts in backport to stable The skills/ directory is not maintained on the stable branch (skill files are unrelated to npm packaging). Extend the backport workflow's auto-resolution — and the AI-assisted fallback prompt — to treat skills/ conflicts the same way docs app conflicts are handled: keep the stable side and drop the incoming change from main. Also updates AGENTS.md to document which directories are stable-only placeholders and how the backport action handles them. * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Nathan Rajlich <n@n8.io> --------- Signed-off-by: Nathan Rajlich <n@n8.io> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent e295bae commit 5889d84

2 files changed

Lines changed: 44 additions & 25 deletions

File tree

.github/workflows/backport.yml

Lines changed: 37 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,30 @@ jobs:
4747
echo "status=clean" >> "$GITHUB_OUTPUT"
4848
echo "cherry_pick_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
4949
else
50-
# The docs app on the stable branch is a minimal placeholder —
51-
# only docs/content/ is actively maintained (markdown files
52-
# bundled into npm packages via prepack scripts). Auto-resolve
53-
# any non-content docs/ conflicts by keeping the stable branch
54-
# version (discarding the incoming change from main).
55-
git diff --name-only --diff-filter=U | grep '^docs/' | grep -v '^docs/content/' | while IFS= read -r file; do
56-
echo "Auto-resolving docs conflict (keeping stable version): $file"
57-
# Check for a stage-2 ("ours") entry in the index, which means
58-
# the file exists on the stable side of the conflict. Otherwise
59-
# the file was newly added on main and we drop it.
60-
if git show ":2:$file" >/dev/null 2>&1; then
61-
git checkout --ours -- "$file"
62-
git add -- "$file"
63-
else
64-
git rm -f -- "$file"
65-
fi
66-
done || true
50+
# Auto-resolve conflicts in directories that are not maintained
51+
# on the stable branch by keeping the stable side (discarding the
52+
# incoming change from main):
53+
# - docs/ (except docs/content/): the docs app is a minimal
54+
# placeholder on stable; only docs/content/ is actively
55+
# maintained (markdown files bundled into npm packages via
56+
# prepack scripts).
57+
# - skills/: skill files are unrelated to npm packaging and
58+
# are not maintained on stable.
59+
git diff --name-only --diff-filter=U \
60+
| { grep -E '^(docs/|skills/)' || true; } \
61+
| { grep -v '^docs/content/' || true; } \
62+
| while IFS= read -r file; do
63+
echo "Auto-resolving conflict (keeping stable version): $file"
64+
# Check for a stage-2 ("ours") entry in the index, which means
65+
# the file exists on the stable side of the conflict. Otherwise
66+
# the file was newly added on main and we drop it.
67+
if git show ":2:$file" >/dev/null 2>&1; then
68+
git checkout --ours -- "$file"
69+
git add -- "$file"
70+
else
71+
git rm -f -- "$file"
72+
fi
73+
done
6774
6875
# Lockfile conflicts can be resolved by re-running pnpm install,
6976
# but only when no other conflicts remain (to avoid pnpm choking
@@ -120,12 +127,19 @@ jobs:
120127
PR title: $PR_TITLE
121128
Commit message: $COMMIT_MSG
122129
123-
IMPORTANT: On the stable branch, only docs/content/ is actively
124-
maintained (markdown files bundled into npm packages). The rest of
125-
the docs app is a minimal placeholder. If any remaining conflicts
126-
involve files under docs/ that are NOT in docs/content/, resolve
127-
them by keeping the stable branch version (the <<<<<<< HEAD side)
128-
and discarding the incoming change from main. If the file does not
130+
IMPORTANT: Some directories are not fully maintained on the stable
131+
branch and should be auto-resolved by keeping the stable side:
132+
133+
- docs/ (except docs/content/): the docs app is a minimal
134+
placeholder on stable; only docs/content/ is actively maintained
135+
(markdown files bundled into npm packages).
136+
- skills/: skill files are unrelated to npm packaging and are not
137+
maintained on stable.
138+
139+
If any remaining conflicts involve files under docs/ that are NOT
140+
in docs/content/, or any files under skills/, resolve them by
141+
keeping the stable branch version (the <<<<<<< HEAD side) and
142+
discarding the incoming change from main. If the file does not
129143
exist on the stable side (HEAD side is empty), remove it with
130144
"git rm". Conflicts in docs/content/ should be resolved normally.
131145

AGENTS.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,12 @@ This repository uses a dual-branch release model with [changesets](https://githu
173173

174174
Both branches trigger the release workflow (`.github/workflows/release.yml`) on push. The changesets action creates a "Version Packages" PR on each branch when there are pending changesets.
175175

176-
**Important:** On the `stable` branch, only `docs/content/` is actively maintained — the rest of the docs app is a minimal placeholder. Documentation is deployed only from `main`. The `docs/content/` directory is kept on `stable` because the markdown files are bundled into npm packages via `prepack` scripts. When backporting changes to `stable`, any conflicts involving docs app files (outside of `docs/content/`) should be resolved by keeping the `stable` branch version (discarding the incoming change from `main`). Conflicts in `docs/content/` should be resolved normally. The backport GitHub Action handles this automatically.
176+
**Important:** Some directories are not fully maintained on the `stable` branch:
177+
178+
- **`docs/`**: Only `docs/content/` is actively maintained on `stable` — the rest of the docs app is a minimal placeholder (documentation is deployed only from `main`). `docs/content/` is kept on `stable` because the markdown files are bundled into npm packages via `prepack` scripts.
179+
- **`skills/`**: Not maintained on `stable` at all. Skill files are unrelated to npm packaging, so there is no reason to keep them in sync on the release branch.
180+
181+
When backporting changes to `stable`, any conflicts involving docs app files (outside of `docs/content/`) or `skills/` files should be resolved by keeping the `stable` branch version (discarding the incoming change from `main`). Conflicts in `docs/content/` should be resolved normally. The backport GitHub Action handles this automatically.
177182

178183
### Changesets
179184

@@ -192,7 +197,7 @@ Both branches trigger the release workflow (`.github/workflows/release.yml`) on
192197

193198
To backport a change from `main` to `stable`, add the `backport-stable` label to the PR on `main`. A GitHub Action (`.github/workflows/backport.yml`) will automatically cherry-pick the squashed commit to `stable`. The label can be added before or after merging — the action triggers on both merge and label events. The changeset file is included in the cherry-pick, so the correct semver bump type is preserved on `stable`.
194199

195-
If the cherry-pick fails due to conflicts, the action first auto-resolves any docs app conflicts (files under `docs/` except `docs/content/`) by keeping the `stable` branch version, since the docs app is a minimal placeholder on `stable` and not actively maintained there. It also auto-resolves `pnpm-lock.yaml` conflicts by re-running `pnpm install`. If those resolve everything, the cherry-pick is pushed directly to `stable`. Otherwise, it attempts to resolve remaining conflicts using [opencode](https://opencode.ai) (AI-powered conflict resolution). If successful, it creates a PR targeting `stable` for human review instead of pushing directly. If the AI cannot resolve the conflicts, the action will comment on the original PR with instructions for manual resolution.
200+
If the cherry-pick fails due to conflicts, the action first auto-resolves conflicts in directories that are not maintained on `stable` (docs app files under `docs/` except `docs/content/`, and any files under `skills/`) by keeping the `stable` branch version. It also auto-resolves `pnpm-lock.yaml` conflicts by re-running `pnpm install`. If those resolve everything, the cherry-pick is pushed directly to `stable`. Otherwise, it attempts to resolve remaining conflicts using [opencode](https://opencode.ai) (AI-powered conflict resolution). If successful, it creates a PR targeting `stable` for human review instead of pushing directly. If the AI cannot resolve the conflicts, the action will comment on the original PR with instructions for manual resolution.
196201

197202
### Pre-release Lifecycle
198203

0 commit comments

Comments
 (0)