Add GitHub Discussions weekly announcement integration (#50)

* Add GitHub Discussions weekly announcement integration - Enable Discussions feature on the repository - Add 'Post to Discussions' step to notify job - Post weekly summary as Discussion in Announcements category - Make step optional with continue-on-error to prevent workflow failure Closes #21 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Address Copilot review comments on PR #50 - Removed continue-on-error: true to allow actual failures to be visible - Added explicit error handling with ::error:: and ::warning:: outputs - Fixed hardcoded repo name to use ${{ github.repository }} for fork compatibility - Fixed unsafe GraphQL mutation string interpolation by using jq for safe JSON encoding - Added guards to check for missing configuration and report clearly to operators Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <copilot@github.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Juan Manuel Servera committed May 18, 2026 at 16:53 UTC 143fac27c09f9f8c4109cb1246667ed9b72220e5
1 file changed +27
.github/workflows/crawl-and-publish.yml
+27
@@ -469,6 +469,33 @@ jobs:
469
470 gh release create "week-${WEEK}" --title "Week ${WEEK} — Tech Trends Summary" --notes-file "$SUMMARY_FILE" --latest
471
472 + - name: Post to Discussions
473 + env:
474 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
475 + run: |
476 + set -e
477 +
478 + SUMMARY=$(ls -t data/analyzed/*-summary.md | head -1)
479 + WEEK=$(basename "$SUMMARY" | sed 's/-summary.md//')
480 +
481 + # Create discussion via GraphQL (Announcements category)
482 + REPO_ID=$(gh api repos/${{ github.repository }} --jq '.node_id')
483 + if [ -z "$REPO_ID" ]; then
484 + echo "::error::Failed to get repository node_id"
485 + exit 1
486 + fi
487 +
488 + CAT_ID=$(gh api graphql -f query='{ repository(owner:"${{ github.repository_owner }}", name:"${{ github.event.repository.name }}") { discussionCategories(first:10) { nodes { id name } } } }' --jq '.data.repository.discussionCategories.nodes[] | select(.name=="Announcements") | .id' 2>&1 || echo "")
489 + if [ -z "$CAT_ID" ]; then
490 + echo "::warning::Announcements discussion category not found; skipping discussion creation"
491 + exit 0
492 + fi
493 +
494 + # Safely encode body as JSON
495 + BODY=$(jq -Rs . < "$SUMMARY")
496 +
497 + gh api graphql -f query="mutation { createDiscussion(input: {repositoryId: \"$REPO_ID\", categoryId: \"$CAT_ID\", title: \"Week $WEEK — Tech Trends Summary\", body: $BODY}) { discussion { url } } }"
498 +
499
500 reskill-check:
501 needs: [crawl]