mirror of
https://github.com/lukaszraczylo/go-telegram.git
synced 2026-10-12 00:45:02 +00:00
ci(regen): stop the weekly no-op update PR
The Telegram page ends with a "page generated in NN.NNms" comment that changes on every fetch. Change detection saw it, so the run dispatched after the codegen fix opened and merged a PR whose only content was that comment. With the merge step in place, that becomes a pointless release every week. Strip the comment on capture, and gate change detection on the generated surface instead of testdata/html/, because the snapshot file name and the latest.html symlink change every run by design. A fresh fetch now matches the committed snapshot byte for byte while the API is unchanged.
This commit is contained in:
@@ -29,7 +29,12 @@ jobs:
|
|||||||
DATE=$(date +%Y-%m-%d)
|
DATE=$(date +%Y-%m-%d)
|
||||||
DEST="testdata/html/snapshot_${DATE}.html"
|
DEST="testdata/html/snapshot_${DATE}.html"
|
||||||
curl -fsSL --user-agent "go-telegram codegen scraper" \
|
curl -fsSL --user-agent "go-telegram codegen scraper" \
|
||||||
https://core.telegram.org/bots/api > "$DEST"
|
https://core.telegram.org/bots/api -o "$DEST.tmp"
|
||||||
|
# The page ends with a "<!-- page generated in NN.NNms -->" comment
|
||||||
|
# that changes on every fetch. Drop it, so an unchanged API produces
|
||||||
|
# a byte-identical snapshot instead of a no-op update PR.
|
||||||
|
sed '/<!-- page generated in .*ms -->/d' "$DEST.tmp" > "$DEST"
|
||||||
|
rm "$DEST.tmp"
|
||||||
ln -sf "snapshot_${DATE}.html" testdata/html/latest.html
|
ln -sf "snapshot_${DATE}.html" testdata/html/latest.html
|
||||||
echo "date=$DATE" >> $GITHUB_OUTPUT
|
echo "date=$DATE" >> $GITHUB_OUTPUT
|
||||||
echo "dest=$DEST" >> $GITHUB_OUTPUT
|
echo "dest=$DEST" >> $GITHUB_OUTPUT
|
||||||
@@ -76,7 +81,10 @@ jobs:
|
|||||||
id: diff
|
id: diff
|
||||||
run: |
|
run: |
|
||||||
git status --porcelain
|
git status --porcelain
|
||||||
if git diff --quiet internal/spec/api.json api/ testdata/html/; then
|
# Gate on the generated surface only. A fresh snapshot file and the
|
||||||
|
# latest.html symlink flip every run, so including testdata/html/
|
||||||
|
# here would open a PR on a week when Telegram changed nothing.
|
||||||
|
if git diff --quiet internal/spec/api.json api/ docs/reference/; then
|
||||||
echo "no_changes=true" >> $GITHUB_OUTPUT
|
echo "no_changes=true" >> $GITHUB_OUTPUT
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
-1
@@ -23112,4 +23112,3 @@ removePreloadInit();
|
|||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
<!-- page generated in 133.23ms -->
|
|
||||||
|
|||||||
Reference in New Issue
Block a user