Skip to content

Commit 769d1ce

Browse files
authored
ci(release): announce releases in repo and org discussions (#18)
Post each release to GitHub Discussions in two places: - repo-level via action-gh-release discussion_category_name (Announcements) - org-level (codellm-devkit/.github) via a createDiscussion GraphQL step, authenticated by ORG_DISCUSSIONS_TOKEN and reusing the composed release body Also add Maintenance (ci/chore) and a catch-all Other category to the changelog config so CI/chore PRs stop dropping out of the release notes.
1 parent cd1ceb4 commit 769d1ce

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

.github/configuration.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
{ "title": "### 🐛 Fixes", "labels": ["fix"] },
55
{ "title": "### ♻️ Refactoring", "labels": ["refactor"] },
66
{ "title": "### 📝 Documentation", "labels": ["docs"] },
7-
{ "title": "### 🧪 Tests", "labels": ["test"] }
7+
{ "title": "### 🧪 Tests", "labels": ["test"] },
8+
{ "title": "### 🔧 Maintenance", "labels": ["ci", "chore"] },
9+
{ "title": "### 📦 Other", "labels": [] }
810
],
911
"ignore_labels": ["ignore-for-release"],
1012
"sort": { "order": "ASC", "on_property": "mergedAt" },

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,43 @@ jobs:
203203
with:
204204
files: release-bins/*
205205
body_path: ${{ runner.temp }}/RELEASE_BODY.md
206+
# Auto-open a repo-level Discussion linked to this release, seeded with
207+
# the same notes. Requires Discussions enabled and this category to exist.
208+
discussion_category_name: Announcements
206209
env:
207210
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
208211

212+
# Mirror the release announcement into the ORG-level discussions, which are
213+
# backed by codellm-devkit/.github. GITHUB_TOKEN can't write cross-repo, so
214+
# this uses a PAT/App token (ORG_DISCUSSIONS_TOKEN) with discussions:write
215+
# on that repo, and posts via the createDiscussion GraphQL mutation. Reuses
216+
# the already-composed RELEASE_BODY.md so org and repo posts stay identical.
217+
- name: Announce in org-level discussions (codellm-devkit/.github)
218+
if: startsWith(github.ref, 'refs/tags/')
219+
continue-on-error: true # a failed org post must not fail an otherwise-good release
220+
env:
221+
GH_TOKEN: ${{ secrets.ORG_DISCUSSIONS_TOKEN }}
222+
VERSION: ${{ steps.ver.outputs.version }}
223+
run: |
224+
set -uo pipefail
225+
OWNER="codellm-devkit"; REPO=".github"; CATEGORY="Announcements"
226+
# The mutation needs GraphQL node IDs, not names — resolve them first.
227+
RESP=$(gh api graphql \
228+
-f query='query($o:String!,$r:String!){repository(owner:$o,name:$r){id discussionCategories(first:25){nodes{id name}}}}' \
229+
-f o="$OWNER" -f r="$REPO") \
230+
|| { echo "::warning::org discussion lookup failed — skipping org announcement."; exit 0; }
231+
REPO_ID=$(echo "$RESP" | jq -r '.data.repository.id')
232+
CAT_ID=$(echo "$RESP" | jq -r --arg c "$CATEGORY" '.data.repository.discussionCategories.nodes[]|select(.name==$c)|.id')
233+
if [[ -z "$REPO_ID" || "$REPO_ID" == "null" || -z "$CAT_ID" ]]; then
234+
echo "::warning::could not resolve $OWNER/$REPO discussion category '$CATEGORY' — skipping org announcement."
235+
exit 0
236+
fi
237+
gh api graphql \
238+
-f query='mutation($rid:ID!,$cid:ID!,$t:String!,$b:String!){createDiscussion(input:{repositoryId:$rid,categoryId:$cid,title:$t,body:$b}){discussion{url}}}' \
239+
-f rid="$REPO_ID" -f cid="$CAT_ID" \
240+
-f t="codeanalyzer-typescript v$VERSION" \
241+
-f b="$(cat "$RUNNER_TEMP/RELEASE_BODY.md")"
242+
209243
- name: Publish wheels to PyPI (Trusted Publishing / OIDC)
210244
if: startsWith(github.ref, 'refs/tags/')
211245
uses: pypa/gh-action-pypi-publish@release/v1

0 commit comments

Comments
 (0)