Harden Section 0 contributor setup
This commit is contained in:
22
README.md
22
README.md
@@ -47,6 +47,7 @@ TARGET_DIR=~/work/rta-handbook \
|
|||||||
## Daily Flow
|
## Daily Flow
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
section0-docs doctor
|
||||||
section0-docs pull
|
section0-docs pull
|
||||||
|
|
||||||
# Edit Markdown files in your normal editor.
|
# Edit Markdown files in your normal editor.
|
||||||
@@ -60,6 +61,27 @@ After a push, ask the projection operator to pull and project. For now that is
|
|||||||
manual. The current operator command lives in
|
manual. The current operator command lives in
|
||||||
`docs/projection-operations.md`.
|
`docs/projection-operations.md`.
|
||||||
|
|
||||||
|
## Contributor Setup
|
||||||
|
|
||||||
|
Anonymous clone/read works on the lab mesh. Pushing requires a Gitea account or
|
||||||
|
token with write access to `section0/rta-handbook`.
|
||||||
|
|
||||||
|
Run this once per checkout:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
section0-docs configure
|
||||||
|
```
|
||||||
|
|
||||||
|
Then prove write access without changing `main`:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
section0-docs push-test
|
||||||
|
```
|
||||||
|
|
||||||
|
`push-test` pushes the current commit to a temporary scratch branch and deletes
|
||||||
|
that branch immediately. If Git prompts for a password, use a Gitea access token
|
||||||
|
rather than your normal account password.
|
||||||
|
|
||||||
## Source Models
|
## Source Models
|
||||||
|
|
||||||
This repo is the Git-backed model: shared docs are canonical in Gitea.
|
This repo is the Git-backed model: shared docs are canonical in Gitea.
|
||||||
|
|||||||
@@ -43,16 +43,22 @@ usage() {
|
|||||||
section0-docs - helper for Section 0 Git Projection repos
|
section0-docs - helper for Section 0 Git Projection repos
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
|
configure set Git author name/email for this repo
|
||||||
|
doctor check clone, author, remote, and read access
|
||||||
open print the repo path
|
open print the repo path
|
||||||
pull pull latest Markdown with --ff-only
|
pull pull latest Markdown with --ff-only
|
||||||
status show Git status
|
status show Git status
|
||||||
commit commit all current changes with MESSAGE
|
commit commit all current changes with MESSAGE
|
||||||
push push current branch
|
push push current branch
|
||||||
|
push-test prove write access with a temporary remote branch
|
||||||
help show this help
|
help show this help
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
|
section0-docs doctor
|
||||||
|
section0-docs configure
|
||||||
section0-docs pull
|
section0-docs pull
|
||||||
section0-docs status
|
section0-docs status
|
||||||
|
section0-docs push-test
|
||||||
MESSAGE="Update concept notes" section0-docs commit
|
MESSAGE="Update concept notes" section0-docs commit
|
||||||
section0-docs push
|
section0-docs push
|
||||||
|
|
||||||
@@ -62,6 +68,42 @@ USAGE
|
|||||||
}
|
}
|
||||||
|
|
||||||
case "\${1:-help}" in
|
case "\${1:-help}" in
|
||||||
|
configure)
|
||||||
|
current_name="\$(git -C "\$REPO_DIR" config user.name || true)"
|
||||||
|
current_email="\$(git -C "\$REPO_DIR" config user.email || true)"
|
||||||
|
printf "Git author name [%s]: " "\$current_name"
|
||||||
|
IFS= read -r author_name
|
||||||
|
printf "Git author email [%s]: " "\$current_email"
|
||||||
|
IFS= read -r author_email
|
||||||
|
if [ -n "\$author_name" ]; then
|
||||||
|
git -C "\$REPO_DIR" config user.name "\$author_name"
|
||||||
|
elif [ -z "\$current_name" ]; then
|
||||||
|
echo "Git author name is required" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -n "\$author_email" ]; then
|
||||||
|
git -C "\$REPO_DIR" config user.email "\$author_email"
|
||||||
|
elif [ -z "\$current_email" ]; then
|
||||||
|
echo "Git author email is required" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
doctor)
|
||||||
|
remote="\$(git -C "\$REPO_DIR" remote get-url origin)"
|
||||||
|
branch="\$(git -C "\$REPO_DIR" branch --show-current)"
|
||||||
|
author_name="\$(git -C "\$REPO_DIR" config user.name || true)"
|
||||||
|
author_email="\$(git -C "\$REPO_DIR" config user.email || true)"
|
||||||
|
echo "Repo: \$REPO_DIR"
|
||||||
|
echo "Remote: \$remote"
|
||||||
|
echo "Branch: \$branch"
|
||||||
|
if [ -n "\$author_name" ] && [ -n "\$author_email" ]; then
|
||||||
|
echo "Git author: \$author_name <\$author_email>"
|
||||||
|
else
|
||||||
|
echo "Git author: missing; run section0-docs configure"
|
||||||
|
fi
|
||||||
|
git -C "\$REPO_DIR" ls-remote --heads origin main >/dev/null
|
||||||
|
echo "Read access: ok"
|
||||||
|
;;
|
||||||
open)
|
open)
|
||||||
printf "%s\n" "\$REPO_DIR"
|
printf "%s\n" "\$REPO_DIR"
|
||||||
;;
|
;;
|
||||||
@@ -79,6 +121,12 @@ case "\${1:-help}" in
|
|||||||
push)
|
push)
|
||||||
git -C "\$REPO_DIR" push
|
git -C "\$REPO_DIR" push
|
||||||
;;
|
;;
|
||||||
|
push-test)
|
||||||
|
branch="section0-smoke-\${USER:-user}-\$(date +%Y%m%d%H%M%S)"
|
||||||
|
git -C "\$REPO_DIR" push origin HEAD:refs/heads/"\$branch"
|
||||||
|
git -C "\$REPO_DIR" push origin :refs/heads/"\$branch"
|
||||||
|
echo "Write access: ok"
|
||||||
|
;;
|
||||||
help|--help|-h)
|
help|--help|-h)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
@@ -98,12 +146,17 @@ Remote: $REPO_URL
|
|||||||
Helper: $COMMAND_PATH
|
Helper: $COMMAND_PATH
|
||||||
|
|
||||||
Daily flow:
|
Daily flow:
|
||||||
|
$COMMAND_NAME doctor
|
||||||
$COMMAND_NAME pull
|
$COMMAND_NAME pull
|
||||||
# edit Markdown
|
# edit Markdown
|
||||||
$COMMAND_NAME status
|
$COMMAND_NAME status
|
||||||
MESSAGE="Update docs" $COMMAND_NAME commit
|
MESSAGE="Update docs" $COMMAND_NAME commit
|
||||||
$COMMAND_NAME push
|
$COMMAND_NAME push
|
||||||
|
|
||||||
|
Contributor setup:
|
||||||
|
$COMMAND_NAME configure
|
||||||
|
$COMMAND_NAME push-test
|
||||||
|
|
||||||
AFFiNE updates after the projection operator pulls and runs projection.
|
AFFiNE updates after the projection operator pulls and runs projection.
|
||||||
|
|
||||||
If $COMMAND_DIR is not on PATH, add this to your shell profile:
|
If $COMMAND_DIR is not on PATH, add this to your shell profile:
|
||||||
|
|||||||
Reference in New Issue
Block a user