Skip to content

Commit dc6c896

Browse files
authored
Add weekly content review workflow
This workflow automates the weekly review of open issues, categorizing them and posting a summary comment on a specified issue.
1 parent 55b3f51 commit dc6c896

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Weekly Content Review and Comment
2+
3+
on:
4+
schedule:
5+
- cron: '0 12 * * 1' # Every Monday at 12:00 UTC
6+
workflow_dispatch:
7+
8+
jobs:
9+
review-issues-and-comment:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
issues: write
13+
contents: read
14+
steps:
15+
- name: Checkout repository (for context, not strictly necessary)
16+
uses: actions/checkout@v4
17+
18+
- name: Gather all open issues (API call)
19+
id: issue-list
20+
uses: octokit/[email protected]
21+
with:
22+
route: GET /repos/${{ github.repository }}/issues
23+
parameters: |
24+
state=open
25+
per_page=100
26+
27+
- name: Categorize issues and prepare comment
28+
id: summarize
29+
run: |
30+
echo "Parsing issues & categorizing for weekly review..."
31+
32+
echo '${{ steps.issue-list.outputs.data }}' > issues.json
33+
34+
COUNT_GRAMMAR=$(jq '[.[] | select(.title | test("grammar|spelling"; "i"))] | length' issues.json)
35+
COUNT_DEPRECATED=$(jq '[.[] | select(.title | test("deprecated|outdated|codeql|dependabot|copilot projects|projects|security"; "i"))] | length' issues.json)
36+
COUNT_SUGGESTED=$(jq '[.[] | select((.title | contains("[REPLACE_WITH_MODULE_TITLE]") | not) and (.title | test("update|improvement|copilot|prompt|exercise|action"; "i")))] | length' issues.json)
37+
COUNT_OTHER=$(jq '[.[] | select(.title | test("broken|support|help|unable|issue|not issued|confused|experience"; "i"))] | length' issues.json)
38+
COUNT_TEMPLATE=$(jq '[.[] | select(.title | contains("[REPLACE_WITH_MODULE_TITLE]"))] | length' issues.json)
39+
40+
REP_DEPRECATED=$(jq -r '[.[] | select(.title | test("deprecated|outdated|codeql|dependabot|copilot projects|projects|security"; "i"))][0].number // ""' issues.json)
41+
REP_SUGGESTED=$(jq -r '[.[] | select((.title | contains("[REPLACE_WITH_MODULE_TITLE]") | not) and (.title | test("update|improvement|copilot|prompt|exercise|action"; "i")))][0].number // ""' issues.json)
42+
REP_OTHER=$(jq -r '[.[] | select(.title | test("broken|support|help|unable|issue|not issued|confused|experience"; "i"))][0].number // ""' issues.json)
43+
REP_TEMPLATE=$(jq -r '[.[] | select(.title | contains("[REPLACE_WITH_MODULE_TITLE]"))][0].number // ""' issues.json)
44+
45+
THIS_WEEK=$(date -u +'%Y-%m-%d')
46+
COMMENT="**November 2025 Weekly Content Review Update**
47+
- Checked as of: $THIS_WEEK
48+
49+
**Issue category counts this week:**
50+
- Grammar/Spelling: $COUNT_GRAMMAR
51+
- Deprecated/Outdated: $COUNT_DEPRECATED"" (e.g., #$REP_DEPRECATED)""
52+
- Suggested Content Updates: $COUNT_SUGGESTED"" (e.g., #$REP_SUGGESTED)""
53+
- Other: $COUNT_OTHER"" (e.g., #$REP_OTHER)""
54+
- Template-Incomplete: $COUNT_TEMPLATE"" (e.g., #$REP_TEMPLATE)""
55+
56+
:octocat: :copilot: Mona (Copilot) has reviewed this update for a Hubber to take further action if needed.
57+
"
58+
59+
echo "$COMMENT" > comment.md
60+
echo "COMMENT_PATH=comment.md" >> $GITHUB_ENV
61+
62+
- name: Create weekly update comment on November review issue
63+
uses: peter-evans/create-or-update-comment@v4
64+
with:
65+
issue-number: 223
66+
body-path: ${{ env.COMMENT_PATH }}
67+
token: ${{ secrets.GITHUB_TOKEN }}
68+
69+
<!-- next steps
70+
71+
Step 4: Confirm the Workflow is Active
72+
73+
Go to your repo on GitHub.
74+
Click on the Actions tab.
75+
Look for "Weekly Content Review and Comment".
76+
You can also manually run it via “Run workflow” (since workflow_dispatch is enabled).
77+
Step 5: Check Comments on the November Review Issue
78+
79+
The job will comment on issue number 223 ("Monthly Content Review Process for MS Learn Repository") with the updated weekly summary.
80+
Each Monday (or after a manual run), review the new comment for the count update.
81+
Requirements
82+
83+
This workflow uses octokit/request-action for API calls, peter-evans/create-or-update-comment for posting, and requires jq (which is installed by default on GitHub’s runners).
84+
Make sure issue 223 exists and is the correct target for these updates.
85+
If issue numbers or logic changes, adjust the workflow accordingly.
86+
Customization Tips
87+
88+
Adjust the regex matching logic in the jq filters to better fit your issue naming conventions.
89+
For other months, duplicate the workflow and update the target issue number and month text as needed.
90+
You can customize the schedule (the cron line) to run on a different day/time or more frequently.
91+
92+
-->

0 commit comments

Comments
 (0)