@@ -9,6 +9,7 @@ permissions:
99 contents : write # required for GitHub Release
1010 id-token : write # required for PyPI Trusted Publishing
1111 actions : write # required for tag deletion
12+ discussions : write # attach the release-linked repo Discussion (Announcements)
1213
1314jobs :
1415 release :
@@ -131,9 +132,43 @@ jobs:
131132 release-assets/*
132133 body_path : ${{ runner.temp }}/RELEASE_BODY.md
133134 generate_release_notes : true # appends categorized "What's Changed" (see .github/release.yml)
135+ # Auto-open a repo-level Discussion linked to this release, seeded with
136+ # the same notes. Requires Discussions enabled and this category to exist.
137+ discussion_category_name : Announcements
134138 env :
135139 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
136140
141+ # Mirror the release announcement into the ORG-level discussions, which are
142+ # backed by codellm-devkit/.github. GITHUB_TOKEN can't write cross-repo, so
143+ # this uses a PAT (ORG_DISCUSSIONS_TOKEN) with repo scope, and posts via the
144+ # createDiscussion GraphQL mutation. Reuses the already-composed RELEASE_BODY.md
145+ # so org and repo posts stay identical.
146+ - name : Announce in org-level discussions (codellm-devkit/.github)
147+ if : startsWith(github.ref, 'refs/tags/')
148+ continue-on-error : true # a failed org post must not fail an otherwise-good release
149+ env :
150+ GH_TOKEN : ${{ secrets.ORG_DISCUSSIONS_TOKEN }}
151+ VERSION : ${{ steps.tag_name.outputs.current_version }}
152+ run : |
153+ set -uo pipefail
154+ OWNER="codellm-devkit"; REPO=".github"; CATEGORY="Announcements"
155+ # The mutation needs GraphQL node IDs, not names — resolve them first.
156+ RESP=$(gh api graphql \
157+ -f query='query($o:String!,$r:String!){repository(owner:$o,name:$r){id discussionCategories(first:25){nodes{id name}}}}' \
158+ -f o="$OWNER" -f r="$REPO") \
159+ || { echo "::warning::org discussion lookup failed — skipping org announcement."; exit 0; }
160+ REPO_ID=$(echo "$RESP" | jq -r '.data.repository.id')
161+ CAT_ID=$(echo "$RESP" | jq -r --arg c "$CATEGORY" '.data.repository.discussionCategories.nodes[]|select(.name==$c)|.id')
162+ if [[ -z "$REPO_ID" || "$REPO_ID" == "null" || -z "$CAT_ID" ]]; then
163+ echo "::warning::could not resolve $OWNER/$REPO discussion category '$CATEGORY' — skipping org announcement."
164+ exit 0
165+ fi
166+ gh api graphql \
167+ -f query='mutation($rid:ID!,$cid:ID!,$t:String!,$b:String!){createDiscussion(input:{repositoryId:$rid,categoryId:$cid,title:$t,body:$b}){discussion{url}}}' \
168+ -f rid="$REPO_ID" -f cid="$CAT_ID" \
169+ -f t="codeanalyzer-python v$VERSION" \
170+ -f b="$(cat "$RUNNER_TEMP/RELEASE_BODY.md")"
171+
137172 - name : Publish to PyPI via Trusted Publishing
138173 run : uv publish
139174
0 commit comments