ci(promote): mirror develop to GitHub contrib
Outside contributors target GitHub `contrib`, which tracked released `main` and was reset after every release. Between releases they were working against code the current develop no longer had — a PR touching an area that changed on develop was obsolete the day it opened, and only the maintainer could see why. `contrib` now mirrors `develop`: promote.yml runs on develop pushes too and pushes to `contrib`, not forced. The refusal is the guard — it fires exactly when `contrib` holds external merges not yet carried into develop, and the job says so instead of forcing over them. `main` keeps its one meaning: released code. Gitea's `contrib` is gone; it was only ever a copy waiting to be forgotten. AGENTS.md and CONTRIBUTING.md describe the new flow, drop the post-release reset, and note that a develop conflict is now the contributor's to resolve because they can see it. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
1 parent
6717b15ee9
commit
25f4144a38
3 files changed
+34
-16
No files matched your search
@@ -1,9 +1,17 @@
|
||||
name: Promote → GitHub
|
||||
|
||||
# Promotion. Runs on GITEA ONLY. Mirrors ONLY `main` to the public GitHub repo — develop and
|
||||
# feature branches stay Gitea-private (this is why we don't use Gitea's push-mirror, which
|
||||
# Promotion. Runs on GITEA ONLY. Mirrors two branches to the public GitHub repo and nothing else:
|
||||
#
|
||||
# main → GitHub main the production mirror
|
||||
# develop → GitHub contrib what outside contributors fork from and target
|
||||
#
|
||||
# Feature branches stay Gitea-private (this is why we don't use Gitea's push-mirror, which
|
||||
# would expose every branch).
|
||||
#
|
||||
# Neither push is forced. For `contrib` that is the guard, not a limitation: the push is refused
|
||||
# exactly when `contrib` holds external merges that have not been carried into `develop` yet
|
||||
# (AGENTS.md, "External contributions"). Carry them and the next develop push fast-forwards.
|
||||
#
|
||||
# Tags are deliberately NOT mirrored. The same `v*` tag means two different things on the two
|
||||
# forges: on Gitea it stages to Verdaccio (`stage.yml`), on GitHub it publishes to npm and
|
||||
# JSR, and a JSR version can never be replaced or removed. Promoting the tag is therefore a
|
||||
@@ -16,7 +24,7 @@ name: Promote → GitHub
|
||||
# promoting `main` — a publish nobody chose, of a commit nobody was looking at.
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
branches: [main, develop]
|
||||
|
||||
jobs:
|
||||
push-github:
|
||||
@@ -26,9 +34,17 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # full history for a clean push
|
||||
- name: Push main to GitHub
|
||||
- name: Push to GitHub
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_PROMOTE_TOKEN }}
|
||||
run: |
|
||||
case "$GITHUB_REF_NAME" in
|
||||
main) target=main ;;
|
||||
develop) target=contrib ;;
|
||||
*) echo "::error::promote runs for main and develop only, got '$GITHUB_REF_NAME'"; exit 1 ;;
|
||||
esac
|
||||
git remote add github "https://x-access-token:${GH_TOKEN}@github.com/Expressive-Tea/green-tea.git"
|
||||
git push github "HEAD:refs/heads/main"
|
||||
if ! git push github "HEAD:refs/heads/${target}"; then
|
||||
echo "::error::GitHub ${target} has commits that ${GITHUB_REF_NAME} does not. For contrib that means external merges not yet carried into develop — carry them (AGENTS.md, External contributions); never force this push."
|
||||
exit 1
|
||||
fi
|
||||
Reference in new issue
Block a user