Fix sync workflow self-include (polluted GitHub with gh-mirror/) #111
@@ -48,24 +48,26 @@ jobs:
|
|||||||
SRC_SHA="$(git rev-parse --short HEAD)"
|
SRC_SHA="$(git rev-parse --short HEAD)"
|
||||||
|
|
||||||
# Clone the GitHub mirror into a sibling working dir
|
# Clone the GitHub mirror into a sibling working dir
|
||||||
git clone --depth=1 "https://x-access-token:${GH_MIRROR_TOKEN}@github.com/${GH_REPO}.git" gh-mirror
|
GH_DIR="${RUNNER_TEMP:-/tmp}/awc-gh-mirror"; rm -rf "$GH_DIR"; git clone --depth=1 "https://x-access-token:${GH_MIRROR_TOKEN}@github.com/${GH_REPO}.git" "$GH_DIR"
|
||||||
|
|
||||||
# Mirror this checkout's tree into gh-mirror/ with the exclusions.
|
# Mirror this checkout's tree into gh-mirror/ with the exclusions.
|
||||||
# --delete drops files removed on the source; --exclude='.git' protects
|
# --delete drops files removed on the source; --exclude='.git' protects
|
||||||
# both repos' .git dirs from rsync touching them.
|
# both repos' .git dirs from rsync touching them.
|
||||||
|
# belt-and-suspenders exclude of the clone dir name in case anyone re-uses ./gh-mirror.
|
||||||
rsync -a --delete \
|
rsync -a --delete \
|
||||||
--exclude='.git' \
|
--exclude='.git' \
|
||||||
--exclude='.gitea/' \
|
--exclude='.gitea/' \
|
||||||
--exclude='.claude/' \
|
--exclude='.claude/' \
|
||||||
--exclude='blog/' \
|
--exclude='blog/' \
|
||||||
--exclude='handoff.md' \
|
--exclude='handoff.md' \
|
||||||
|
--exclude='gh-mirror/' \
|
||||||
--exclude='__pycache__/' \
|
--exclude='__pycache__/' \
|
||||||
--exclude='*.pyc' \
|
--exclude='*.pyc' \
|
||||||
--exclude='tasks.json' \
|
--exclude='tasks.json' \
|
||||||
--exclude='.DS_Store' \
|
--exclude='.DS_Store' \
|
||||||
./ gh-mirror/
|
./ "$GH_DIR"/
|
||||||
|
|
||||||
cd gh-mirror
|
cd "$GH_DIR"
|
||||||
git add -A
|
git add -A
|
||||||
if git diff --cached --quiet; then
|
if git diff --cached --quiet; then
|
||||||
echo "no relevant changes for the mirror (source push only touched excluded paths); skipping"
|
echo "no relevant changes for the mirror (source push only touched excluded paths); skipping"
|
||||||
|
|||||||
Reference in New Issue
Block a user