Skip to content

AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary

Fix release pipeline review findings on #872

Trevin Chow5cd86083c10b
diff --git a/.github/scripts/prepare_release.py b/.github/scripts/prepare_release.py
index 06c98d9b..5f2095eb 100755
--- a/.github/scripts/prepare_release.py
+++ b/.github/scripts/prepare_release.py
@@ -185,10 +185,16 @@ def main(argv: list[str] | None = None) -> int:
current = read_current_version()
version = args.version or next_version(current, args.bump)
_parse_version(version)
- if _parse_version(version) <= _parse_version(current) and args.version:
- # Allow equal only for dry-run rebuild experiments; refuse downgrades.
- if _parse_version(version) < _parse_version(current):
+ if args.version:
+ parsed_new = _parse_version(version)
+ parsed_cur = _parse_version(current)
+ if parsed_new < parsed_cur:
raise SystemExit(f"Refusing to downgrade {current} → {version}")
+ if parsed_new == parsed_cur and not args.dry_run:
+ raise SystemExit(
+ f"Refusing to re-release {current}; pass --bump or a newer --version "
+ "(use --dry-run to preview towncrier output for the current version)"
+ )
print(f"Current version: {current}")
print(f"Next version: {version}")
diff --git a/.github/workflows/changelog-guard.yml b/.github/workflows/changelog-guard.yml
index 1d7db9fb..45dbf5a2 100644
--- a/.github/workflows/changelog-guard.yml
+++ b/.github/workflows/changelog-guard.yml
@@ -34,15 +34,11 @@ jobs:
set -euo pipefail
LABELS="$(gh api "repos/${{ github.repository }}/issues/${PR_NUMBER}/labels" --jq '.[].name')"
- TITLE="$(gh api "repos/${{ github.repository }}/pulls/${PR_NUMBER}" --jq '.title')"
IS_RELEASE=0
SKIP_CHANGELOG=0
if printf '%s\n' "${LABELS}" | grep -qx 'release'; then
IS_RELEASE=1
fi
- if printf '%s\n' "${TITLE}" | grep -qE '^chore\(release\): bump version to '; then
- IS_RELEASE=1
- fi
if printf '%s\n' "${LABELS}" | grep -qx 'skip-changelog'; then
SKIP_CHANGELOG=1
fi
diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml
index d85b02e1..c03f9ead 100644
--- a/.github/workflows/prepare-release.yml
+++ b/.github/workflows/prepare-release.yml
@@ -1,7 +1,7 @@
name: Prepare release
# Opens a chore(release) PR that runs towncrier + lockstep version bumps.
-# Merge of that PR is tagged by tag-release.yml; tag push runs release.yml.
+# Merge of that PR is tagged by tag-release.yml; tag push / dispatch runs release.yml.
on:
workflow_dispatch:
@@ -33,6 +33,7 @@ jobs:
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
+ persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
@@ -65,10 +66,13 @@ jobs:
GH_TOKEN: ${{ github.token }}
VERSION: ${{ steps.prep.outputs.version }}
BRANCH: ${{ steps.prep.outputs.branch }}
+ DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
+ REPOSITORY: ${{ github.repository }}
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+ git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${REPOSITORY}.git"
if git ls-remote --exit-code --heads origin "${BRANCH}" >/dev/null 2>&1; then
echo "Branch ${BRANCH} already exists on origin — aborting to avoid clobbering."
@@ -122,5 +126,5 @@ jobs:
--title "chore(release): bump version to ${VERSION}" \
--body "${BODY}" \
--label "release" \
- --base "${{ github.event.repository.default_branch }}" \
+ --base "${DEFAULT_BRANCH}" \
--head "${BRANCH}"
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 79229d3d..bbb7ba06 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -4,9 +4,20 @@ on:
push:
tags:
- "v*"
+ # tag-release.yml dispatches this because GITHUB_TOKEN tag pushes do not
+ # start other workflows.
+ workflow_dispatch:
+ inputs:
+ tag:
+ description: Tag to release (e.g. v3.18.2)
+ required: true
+ type: string
permissions: {}
+env:
+ # Tag push uses ref_name (vX.Y.Z); dispatch from tag-release passes inputs.tag.
+ RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref_name }}
jobs:
# Build the existing .skill artifact (Claude Code / Codex / Cursor install
@@ -22,6 +33,7 @@ jobs:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
+ ref: ${{ env.RELEASE_TAG }}
fetch-depth: 0
persist-credentials: false
@@ -70,6 +82,7 @@ jobs:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
+ ref: ${{ env.RELEASE_TAG }}
persist-credentials: false
- name: Set up Go
@@ -102,7 +115,7 @@ jobs:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
CGO_ENABLED: "0"
- RELEASE_VERSION: ${{ github.ref_name }}
+ RELEASE_VERSION: ${{ env.RELEASE_TAG }}
run: |
mkdir -p mcp/build
go -C mcp build \
@@ -147,6 +160,7 @@ jobs:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
+ ref: ${{ env.RELEASE_TAG }}
fetch-depth: 0
persist-credentials: false
@@ -159,7 +173,7 @@ jobs:
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
- RELEASE_TAG: ${{ github.ref_name }}
+ RELEASE_TAG: ${{ env.RELEASE_TAG }}
run: |
gh release create "${RELEASE_TAG}" \
dist/last30days.skill \
diff --git a/.github/workflows/tag-release.yml b/.github/workflows/tag-release.yml
index aee3c2f7..54a90f5e 100644
--- a/.github/workflows/tag-release.yml
+++ b/.github/workflows/tag-release.yml
@@ -1,7 +1,7 @@
name: Tag release
-# After a prepare-release PR merges to main, create the vX.Y.Z tag so
-# release.yml can build .skill / .mcpb artifacts and publish the GitHub Release.
+# After a prepare-release PR merges to main, create the vX.Y.Z tag and
+# dispatch release.yml (GITHUB_TOKEN tag pushes do not start other workflows).
on:
push:
@@ -18,15 +18,22 @@ jobs:
if: startsWith(github.event.head_commit.message, 'chore(release): bump version to ')
permissions:
contents: write
+ actions: write
+ pull-requests: read
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
+ persist-credentials: false
- - name: Create annotated tag
+ - name: Create annotated tag and dispatch Release
env:
+ GH_TOKEN: ${{ github.token }}
HEAD_MSG: ${{ github.event.head_commit.message }}
+ HEAD_SHA: ${{ github.sha }}
+ REPOSITORY: ${{ github.repository }}
+ DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
set -euo pipefail
VERSION="$(printf '%s\n' "${HEAD_MSG}" | head -n1 | sed -n 's/^chore(release): bump version to \([0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\).*/\1/p')"
@@ -42,6 +49,20 @@ jobs:
exit 1
fi
+ # Require the merged PR to carry the repository-controlled `release`
+ # label so a matching title alone cannot mint a tag.
+ PR_NUMBER="$(gh api "repos/${REPOSITORY}/commits/${HEAD_SHA}/pulls" \
+ --jq 'map(select(.base.ref == env.DEFAULT_BRANCH)) | .[0].number // empty')"
+ if [ -z "${PR_NUMBER}" ]; then
+ echo "No PR found for ${HEAD_SHA} into ${DEFAULT_BRANCH} — refusing to tag."
+ exit 1
+ fi
+ if ! gh api "repos/${REPOSITORY}/issues/${PR_NUMBER}/labels" \
+ --jq '.[].name' | grep -qx 'release'; then
+ echo "PR #${PR_NUMBER} lacks the 'release' label — refusing to tag."
+ exit 1
+ fi
+
if git rev-parse -q --verify "refs/tags/${TAG}" >/dev/null; then
echo "Tag ${TAG} already exists locally — nothing to do."
exit 0
@@ -53,6 +74,13 @@ jobs:
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+ git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${REPOSITORY}.git"
git tag -a "${TAG}" -m "Release ${TAG}"
git push origin "refs/tags/${TAG}"
echo "Created and pushed ${TAG}"
+
+ # GITHUB_TOKEN tag pushes do not trigger release.yml; dispatch it.
+ gh workflow run release.yml \
+ --ref "${DEFAULT_BRANCH}" \
+ -f "tag=${TAG}"
+ echo "Dispatched release.yml for ${TAG}"
diff --git a/tests/test_changelog_workflow.py b/tests/test_changelog_workflow.py
index b39db5ec..41c95720 100644
--- a/tests/test_changelog_workflow.py
+++ b/tests/test_changelog_workflow.py
@@ -73,6 +73,20 @@ class TestChangelogWorkflow(unittest.TestCase):
self.assertEqual(mod.next_version("3.18.1", "minor"), "3.19.0")
self.assertEqual(mod.next_version("3.18.1", "major"), "4.0.0")
+ def test_main_refuses_equal_version_outside_dry_run(self) -> None:
+ mod = _load_prepare_release()
+ with tempfile.TemporaryDirectory() as tmp:
+ tmp_path = Path(tmp)
+ (tmp_path / "pyproject.toml").write_text(
+ '[project]\nname = "last30days-skill"\nversion = "3.18.1"\n',
+ encoding="utf-8",
+ )
+ mod.ROOT = tmp_path
+ mod.PYPROJECT = tmp_path / "pyproject.toml"
+ with self.assertRaises(SystemExit) as ctx:
+ mod.main(["--version", "3.18.1"])
+ self.assertIn("Refusing to re-release", str(ctx.exception))
+
def test_bump_all_updates_lockstep_surfaces(self) -> None:
mod = _load_prepare_release()
with tempfile.TemporaryDirectory() as tmp: