Skip to content

Commit d0603fb

Browse files
committed
fix: skip the static-site sync when a release changes no page
1 parent 8525a89 commit d0603fb

2 files changed

Lines changed: 30 additions & 9 deletions

File tree

‎.github/workflows/sync-static-site.yml‎

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,34 @@ jobs:
9696
git push origin --delete "$BRANCH"
9797
fi
9898
99-
# A release that ships canister changes without touching docs/ leaves
100-
# the synced pages byte-identical, so there is no content to review.
101-
# The pin still has to move: it is allowed to sit on a commit only
102-
# while no release carries the pages, and skipping here would strand
103-
# it on that commit for good. So the PR is opened either way, and the
104-
# body says which of the two it is.
10599
CHANGED=$(git -C /tmp/certified-assets diff --name-only "${PIN}..${TAG}" -- docs/)
106-
echo "needed=true" >> $GITHUB_OUTPUT
107100
if [ -z "$CHANGED" ]; then
108-
echo "No docs/ changes between $PIN and $TAG: advancing the pin only."
109-
echo "pin_only=true" >> $GITHUB_OUTPUT
101+
# A release that ships canister changes without touching docs/ leaves
102+
# the synced pages byte-identical, so there is nothing to review. Two
103+
# cases, and only one of them is worth a pull request.
104+
if [ -n "$INPUT_REF" ] || ! git -C /tmp/certified-assets show-ref \
105+
--verify --quiet "refs/tags/${PIN}"; then
106+
# The pin is a commit (or a ref was dispatched by hand). Moving it
107+
# onto the tag is the point: a commit pin is allowed only while no
108+
# release carries the pages, and skipping here would strand it
109+
# there for good.
110+
echo "No docs/ changes between $PIN and $TAG: advancing the pin only."
111+
echo "needed=true" >> $GITHUB_OUTPUT
112+
echo "pin_only=true" >> $GITHUB_OUTPUT
113+
else
114+
# The pin is already a tag, so a pull request would carry an empty
115+
# page diff and a bumped ref, for a reader to review and merge with
116+
# nothing in it. The pin lags the release and stays accurate: it
117+
# says which ref this copy came from, and the copy still matches it.
118+
# The release itself is not lost, since the recipe that deploys this
119+
# canister releases in lockstep and is tracked under `watched`.
120+
echo "No docs/ changes between $PIN and $TAG, and the pin is a tag."
121+
echo "Nothing to sync."
122+
echo "needed=false" >> $GITHUB_OUTPUT
123+
exit 0
124+
fi
110125
else
126+
echo "needed=true" >> $GITHUB_OUTPUT
111127
echo "Changed upstream pages:"
112128
echo "$CHANGED"
113129
echo "pin_only=false" >> $GITHUB_OUTPUT

‎.sources/upstream.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@
6565
"range contains before pinning past a tag, and prefer a tag whenever one",
6666
"carries the pages. The sync workflow moves the pin onto a tag at the next",
6767
"release even when no page changed, so a commit pin is never permanent.",
68+
"Once it is a tag, a release that changes no page is skipped instead: the",
69+
"pin then lags the latest release and stays accurate, since it records the",
70+
"ref this copy came from and the copy still matches it. The release is not",
71+
"missed either way, because the recipe that deploys this canister releases",
72+
"in lockstep and is tracked under `watched`.",
6873
"History: the first sync used d9cb7df, because certified-assets#124 landed",
6974
"the frontmatter contract this sync requires after the v0.3.3 tag."
7075
]

0 commit comments

Comments
 (0)