-
Notifications
You must be signed in to change notification settings - Fork 1k
Discussion management #426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mvadari
wants to merge
64
commits into
master
Choose a base branch
from
discussion-management
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 9968c96
use sofa script
mvadari 5f4f3aa
Merge branch 'master' into discussion-management
mvadari a0691b4
oops
mvadari d92cf91
change owner
mvadari 8fd37d6
update script link
mvadari 096d22a
Merge branch 'master' into discussion-management
mvadari 5b1103d
attempt #2
mvadari 0c97dbf
run forreal (fingers crossed)
mvadari 346a2e6
fix
mvadari 6a46309
fix
mvadari 32980e8
try again
mvadari 85b299e
better error handling
mvadari 5b3909d
fix hopefully?
mvadari 00bfb34
Merge remote-tracking branch 'upstream/master' into discussion-manage…
mvadari 097b2b3
try different URL
mvadari 474fcbf
switch back to graphql
mvadari e0b524f
try again
mvadari 4adf9d5
accidentally removed run
mvadari e191f7c
try again
mvadari 8b46fbe
try again
mvadari a0dcde5
augment attempt
mvadari e67265c
change to updated, exclude closed
mvadari dd79f39
Merge branch 'master' into discussion-management
mvadari 9981bd1
test out full flow
mvadari c709059
fix
mvadari a64ffe3
try again
mvadari cec3031
try one more time
mvadari 86ffea7
fingers crossed
mvadari 1662244
new error
mvadari 19bf175
add comments
mvadari bf74962
switch to 3 years for testing
mvadari 90f7826
test (fingers crossed...)
mvadari 514175e
fix permissions
mvadari cea9b55
try again
mvadari b698163
fix secret name
mvadari 8635770
debug
mvadari 7fff2cf
try again
mvadari 29cae03
try again
mvadari 8ca726f
add dry run
mvadari ecf3b23
try the app
mvadari 2eb752e
change time
mvadari f36132d
try to skip chmod step
mvadari d1f8fc0
Apply suggestions from code review
mvadari 02eef97
Update .github/scripts/process-stale-discussions.sh
mvadari 0ac7f0f
Merge branch 'master' into discussion-management
mvadari d6912f0
Merge branch 'master' into discussion-management
mvadari 1b6ac67
switch cronjob to every day
mvadari 8819920
check author of comment
mvadari 540ac84
use pagination
mvadari cf100c4
more complex comments
mvadari b8ec1c4
fix bot login permission issue
mvadari ec05fb4
fix null
mvadari 7708de7
allow the warning message to change
mvadari bef1a01
Update discussions.yml
mvadari e479861
fix close cutoff time
mvadari 9146204
<= instead of <
mvadari 5e54285
split out jq scripts for maintainability
mvadari 271aee3
respond to more copilot comments
mvadari 628fc32
fix permission check
mvadari e0f8c85
respond to copilot comments
mvadari 69e1430
more comments
mvadari bbe3e4d
check warning message
mvadari 11dd27a
1000 -> 900
mvadari File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) | ||
mvadari marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # 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 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.