Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
edd08cf
add stale discussion check
mvadari Sep 5, 2025
9968c96
use sofa script
mvadari Sep 5, 2025
5f4f3aa
Merge branch 'master' into discussion-management
mvadari Sep 5, 2025
a0691b4
oops
mvadari Sep 5, 2025
d92cf91
change owner
mvadari Sep 5, 2025
8fd37d6
update script link
mvadari Sep 5, 2025
096d22a
Merge branch 'master' into discussion-management
mvadari Sep 8, 2025
5b1103d
attempt #2
mvadari Sep 9, 2025
0c97dbf
run forreal (fingers crossed)
mvadari Sep 9, 2025
346a2e6
fix
mvadari Sep 9, 2025
6a46309
fix
mvadari Sep 9, 2025
32980e8
try again
mvadari Sep 9, 2025
85b299e
better error handling
mvadari Sep 9, 2025
5b3909d
fix hopefully?
mvadari Sep 9, 2025
00bfb34
Merge remote-tracking branch 'upstream/master' into discussion-manage…
mvadari Sep 9, 2025
097b2b3
try different URL
mvadari Sep 9, 2025
474fcbf
switch back to graphql
mvadari Sep 9, 2025
e0b524f
try again
mvadari Sep 9, 2025
4adf9d5
accidentally removed run
mvadari Sep 9, 2025
e191f7c
try again
mvadari Sep 9, 2025
8b46fbe
try again
mvadari Sep 9, 2025
a0dcde5
augment attempt
mvadari Dec 17, 2025
e67265c
change to updated, exclude closed
mvadari Dec 17, 2025
dd79f39
Merge branch 'master' into discussion-management
mvadari Dec 17, 2025
9981bd1
test out full flow
mvadari Dec 17, 2025
c709059
fix
mvadari Dec 17, 2025
a64ffe3
try again
mvadari Dec 17, 2025
cec3031
try one more time
mvadari Dec 17, 2025
86ffea7
fingers crossed
mvadari Dec 17, 2025
1662244
new error
mvadari Dec 17, 2025
19bf175
add comments
mvadari Dec 17, 2025
bf74962
switch to 3 years for testing
mvadari Dec 22, 2025
90f7826
test (fingers crossed...)
mvadari Dec 22, 2025
514175e
fix permissions
mvadari Dec 22, 2025
cea9b55
try again
mvadari Dec 22, 2025
b698163
fix secret name
mvadari Dec 22, 2025
8635770
debug
mvadari Dec 23, 2025
7fff2cf
try again
mvadari Dec 23, 2025
29cae03
try again
mvadari Dec 23, 2025
8ca726f
add dry run
mvadari Dec 23, 2025
ecf3b23
try the app
mvadari Dec 23, 2025
2eb752e
change time
mvadari Dec 23, 2025
f36132d
try to skip chmod step
mvadari Dec 24, 2025
d1f8fc0
Apply suggestions from code review
mvadari Jan 5, 2026
02eef97
Update .github/scripts/process-stale-discussions.sh
mvadari Jan 14, 2026
0ac7f0f
Merge branch 'master' into discussion-management
mvadari Jan 14, 2026
d6912f0
Merge branch 'master' into discussion-management
mvadari Jan 21, 2026
1b6ac67
switch cronjob to every day
mvadari Jan 22, 2026
8819920
check author of comment
mvadari Jan 22, 2026
540ac84
use pagination
mvadari Jan 22, 2026
cf100c4
more complex comments
mvadari Jan 22, 2026
b8ec1c4
fix bot login permission issue
mvadari Jan 22, 2026
ec05fb4
fix null
mvadari Jan 22, 2026
7708de7
allow the warning message to change
mvadari Jan 22, 2026
bef1a01
Update discussions.yml
mvadari Jan 22, 2026
e479861
fix close cutoff time
mvadari Jan 22, 2026
9146204
<= instead of <
mvadari Jan 22, 2026
5e54285
split out jq scripts for maintainability
mvadari Jan 22, 2026
271aee3
respond to more copilot comments
mvadari Jan 22, 2026
628fc32
fix permission check
mvadari Jan 22, 2026
e0f8c85
respond to copilot comments
mvadari Jan 23, 2026
69e1430
more comments
mvadari Jan 23, 2026
bbe3e4d
check warning message
mvadari Jan 23, 2026
11dd27a
1000 -> 900
mvadari Jan 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/scripts/filter-discussions-to-close.jq
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Filter discussions that should be closed
# A discussion should be closed if:
# 1. It has a warning comment containing the unique marker
# 2. That warning comment was posted by the bot
# 3. That warning comment is older than WARNING_DAYS
# 4. The discussion hasn't been updated since the warning (or updates are also old)
#
# Input: GraphQL response with discussions data
# Arguments:
# $warningCutoff - ISO 8601 timestamp for warning age threshold
# $marker - Unique marker string to identify warning comments
# $botLogin - GitHub login of the bot user
# Output: JSON objects (one per line) for discussions that should be closed

.data.repository.discussions.nodes[]

# Only process open discussions
| select(.closed == false)

# Store the discussion for later reference
| . as $discussion

# Find the most recent warning comment from the bot
# Note: We only look at the last 100 comments (fetched by the shell script).
# This is intentional - if there are 100+ comments after a warning, the discussion
# is clearly active and should not be closed.
| (
(.comments.nodes // [])
| map(
select(.body | contains($marker))
| select(.author.login == $botLogin)
)
| last
) as $warningComment

# Only proceed if a warning comment exists
| select($warningComment != null)

# Only proceed if the warning comment is old enough
| select($warningComment.createdAt <= $warningCutoff)

# Only proceed if the discussion hasn't been updated since the warning
| select($discussion.updatedAt < $warningComment.createdAt)

# Output as JSON
| @json
48 changes: 48 additions & 0 deletions .github/scripts/filter-discussions-to-warn.jq
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Filter discussions that should receive a warning
# A discussion should be warned if:
# 1. It hasn't been updated in STALE_DAYS
# 2. Either:
# a. It doesn't have a warning comment (with unique marker) from the bot yet, OR
# b. It has a warning from the bot but was updated after that warning (user responded, so we warn again)
#
# Input: GraphQL response with discussions data
# Arguments:
# $staleCutoff - ISO 8601 timestamp for staleness threshold
# $marker - Unique marker string to identify warning comments
# $botLogin - GitHub login of the bot user
# Output: JSON objects (one per line) for discussions that should be warned

.data.repository.discussions.nodes[]

# Only process open discussions
| select(.closed == false)

# Only process discussions that are stale (not updated recently)
| select(.updatedAt < $staleCutoff)

# Store the discussion for later reference
| . as $discussion

# Find the most recent warning comment from the bot
# Note: We only look at the last 100 comments (fetched by the shell script).
# This is intentional - if there are 100+ comments after a warning, the discussion
# is clearly active and should not be warned again.
| (
(.comments.nodes // [])
| map(
select(.body | contains($marker))
| select(.author.login == $botLogin)
)
| last
) as $warningComment

# Only proceed if:
# - No warning comment exists yet, OR
# - Discussion was updated after the last warning (user responded)
| select(
$warningComment == null
or $discussion.updatedAt > $warningComment.createdAt
)

# Output as JSON
| @json
Loading