Skip to content

Commit d925a1d

Browse files
authored
ci(release): announce releases in repo and org discussions (#183)
- repo-level: add discussion_category_name + discussions:write permission and bump action-gh-release v1 -> v2 so it opens an Announcements discussion linked to the release - org-level: new createDiscussion step posting the same changelog to codellm-devkit/.github, authenticated by ORG_DISCUSSIONS_TOKEN (continue-on-error) - bump version 1.2.0 -> 1.2.1 so a release can exercise it Closes #182
1 parent 9f0260e commit d925a1d

2 files changed

Lines changed: 37 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77

88
permissions:
99
contents: write
10+
discussions: write # attach the release-linked repo Discussion (Announcements)
1011

1112
jobs:
1213
release:
@@ -82,12 +83,46 @@ jobs:
8283
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8384

8485
- name: Publish Release on GitHub
85-
uses: softprops/action-gh-release@v1
86+
uses: softprops/action-gh-release@v2
8687
with:
8788
files: dist/*
8889
body: ${{ steps.gen_changelog.outputs.changelog }}
90+
# Auto-open a repo-level Discussion linked to this release, seeded with
91+
# the same notes. Requires Discussions enabled and this category to exist.
92+
discussion_category_name: Announcements
8993
env:
9094
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9195

96+
# Mirror the release announcement into the ORG-level discussions, which are
97+
# backed by codellm-devkit/.github. GITHUB_TOKEN can't write cross-repo, so
98+
# this uses a PAT (ORG_DISCUSSIONS_TOKEN) with repo scope, and posts via the
99+
# createDiscussion GraphQL mutation. The body (the generated changelog) is
100+
# passed via env to avoid shell-injection, matching the repo-level post.
101+
- name: Announce in org-level discussions (codellm-devkit/.github)
102+
continue-on-error: true # a failed org post must not fail an otherwise-good release
103+
env:
104+
GH_TOKEN: ${{ secrets.ORG_DISCUSSIONS_TOKEN }}
105+
BODY: ${{ steps.gen_changelog.outputs.changelog }}
106+
run: |
107+
set -uo pipefail
108+
VERSION="${GITHUB_REF#refs/tags/v}"
109+
OWNER="codellm-devkit"; REPO=".github"; CATEGORY="Announcements"
110+
# The mutation needs GraphQL node IDs, not names — resolve them first.
111+
RESP=$(gh api graphql \
112+
-f query='query($o:String!,$r:String!){repository(owner:$o,name:$r){id discussionCategories(first:25){nodes{id name}}}}' \
113+
-f o="$OWNER" -f r="$REPO") \
114+
|| { echo "::warning::org discussion lookup failed — skipping org announcement."; exit 0; }
115+
REPO_ID=$(echo "$RESP" | jq -r '.data.repository.id')
116+
CAT_ID=$(echo "$RESP" | jq -r --arg c "$CATEGORY" '.data.repository.discussionCategories.nodes[]|select(.name==$c)|.id')
117+
if [[ -z "$REPO_ID" || "$REPO_ID" == "null" || -z "$CAT_ID" ]]; then
118+
echo "::warning::could not resolve $OWNER/$REPO discussion category '$CATEGORY' — skipping org announcement."
119+
exit 0
120+
fi
121+
gh api graphql \
122+
-f query='mutation($rid:ID!,$cid:ID!,$t:String!,$b:String!){createDiscussion(input:{repositoryId:$rid,categoryId:$cid,title:$t,body:$b}){discussion{url}}}' \
123+
-f rid="$REPO_ID" -f cid="$CAT_ID" \
124+
-f t="python-sdk v$VERSION" \
125+
-f b="$BODY"
126+
92127
- name: Publish package distributions to PyPI
93128
run: uv publish --token ${{ secrets.PYPI_API_TOKEN }}

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "cldk"
3-
version = "1.2.0"
3+
version = "1.2.1"
44
description = "The official Python SDK for Codellm-Devkit."
55
readme = "README.md"
66
license = { text = "Apache-2.0" }

0 commit comments

Comments
 (0)