-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118685 from community/mgriffin/close-action
Add an action to close dormant discussions
- Loading branch information
Showing
4 changed files
with
198 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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,22 @@ | ||
#!/usr/bin/env ruby | ||
# frozen_string_literal: true | ||
|
||
require_relative "../lib/github" | ||
|
||
stale_label_id = "LA_kwDOEfmk4M8AAAABYVCU-g" | ||
owner = "community" | ||
repo = "community" | ||
|
||
discussions = Discussion.to_be_closed(owner:, repo:) | ||
puts "All: #{discussions.count}" | ||
|
||
discussions.each do |discussion| | ||
puts "#{discussion.url} - #{discussion.title}" | ||
result = discussion.close_as_outdated | ||
if errors = result.dig("errors") | ||
puts "#{errors.dig(0, "type")}: #{errors.dig(0, "message")}" | ||
exit | ||
end | ||
|
||
sleep 10 | ||
end |
This file contains 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
This file contains 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,29 @@ | ||
name: Close out dormant discussions | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
# At 01:23 every day | ||
- cron: '23 1 * * *' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
discussions: write | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@5f19ec79cedfadb78ab837f95b87734d0003c899 | ||
|
||
- name: Bundle install | ||
run: bundle install | ||
|
||
- name: Close out discussions | ||
run: .github/actions/close | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
This file contains 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