Merge pull request #126038 from community/mgriffin/unlabel

Set an action to unlable discussions when they're commented on
This commit is contained in:
Mike Griffin 2024-05-27 17:07:49 +01:00 коммит произвёл GitHub
Родитель 8a37c66bff 8a699771ba
Коммит e4783d33a2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
3 изменённых файлов: 30 добавлений и 3 удалений

Просмотреть файл

6
.github/lib/discussions.rb поставляемый
Просмотреть файл

@ -14,7 +14,7 @@ Discussion = Struct.new(
return [] if owner.nil? || repo.nil?
cutoff_date = Time.now.advance(days: -60).to_date.to_s
searchquery = "repo:#{owner}/#{repo} is:unanswered is:open is:unlocked updated:<#{cutoff_date} category:Copilot category:Accessibility category:\\\"Projects and Issues\\\" category:Sponsors category:Actions category:\\\"API and Webhooks\\\" category:\\\"Code Search and Navigation\\\" category: \\\"Code Security\\\" category:Codespaces category:Discussions category:Feed category:Lists category:Mobile category:npm category:Packages category:Pages category:Profile category:\\\"Pull Requests\\\" category:Repositories label:Question"
searchquery = "repo:#{owner}/#{repo} is:unanswered is:open is:unlocked updated:<#{cutoff_date} category:Copilot category:Accessibility category:\\\"Projects and Issues\\\" category:Sponsors category:Actions category:\\\"API and Webhooks\\\" category:\\\"Code Search and Navigation\\\" category:\\\"Code Security\\\" category:Codespaces category:Discussions category:Feed category:Lists category:Mobile category:npm category:Packages category:Pages category:Profile category:\\\"Pull Requests\\\" category:Repositories label:Question"
query = <<~QUERY
{
@ -72,7 +72,7 @@ Discussion = Struct.new(
return [] if owner.nil? || repo.nil?
cutoff_date = Time.now.advance(days: -30).to_date.to_s
searchquery = "repo:#{owner}/#{repo} is:unanswered is:open is:unlocked updated:<#{cutoff_date} category:Copilot category:Accessibility category:\\\"Projects and Issues\\\" category:Sponsors category:Actions category:\\\"API and Webhooks\\\" category:\\\"Code Search and Navigation\\\" category: \\\"Code Security\\\" category:Codespaces category:Discussions category:Feed category:Lists category:Mobile category:npm category:Packages category:Pages category:Profile category:\\\"Pull Requests\\\" category:Repositories label:Question label:inactive"
searchquery = "repo:#{owner}/#{repo} is:unanswered is:open is:unlocked updated:<#{cutoff_date} category:Copilot category:Accessibility category:\\\"Projects and Issues\\\" category:Sponsors category:Actions category:\\\"API and Webhooks\\\" category:\\\"Code Search and Navigation\\\" category:\\\"Code Security\\\" category:Codespaces category:Discussions category:Feed category:Lists category:Mobile category:npm category:Packages category:Pages category:Profile category:\\\"Pull Requests\\\" category:Repositories label:Question label:inactive"
query = <<~QUERY
{
@ -135,7 +135,7 @@ Discussion = Struct.new(
def self.to_remove_label(owner: nil, repo: nil)
return [] if owner.nil? || repo.nil?
searchquery = "repo:#{owner}/#{repo} is:unanswered is:open category:Copilot category:Accessibility category:\\\"Projects and Issues\\\" category:Sponsors category:Actions category:\\\"API and Webhooks\\\" category:\\\"Code Search and Navigation\\\" category: \\\"Code Security\\\" category:Codespaces category:Discussions category:Feed category:Lists category:Mobile category:npm category:Packages category:Pages category:Profile category:\\\"Pull Requests\\\" category:Repositories label:Question label:inactive"
searchquery = "repo:#{owner}/#{repo} is:unanswered is:open category:Copilot category:Accessibility category:\\\"Projects and Issues\\\" category:Sponsors category:Actions category:\\\"API and Webhooks\\\" category:\\\"Code Search and Navigation\\\" category:\\\"Code Security\\\" category:Codespaces category:Discussions category:Feed category:Lists category:Mobile category:npm category:Packages category:Pages category:Profile category:\\\"Pull Requests\\\" category:Repositories label:Question label:inactive"
query = <<~QUERY
{

27
.github/workflows/remove-inactive-label.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,27 @@
name: Remove the inactive label
on:
discussion_comment:
types: [created]
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@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
- name: Bundle install
run: bundle install
- name: Remove the label
run: .github/actions/remove-inactive-label
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_ID: ${{ github.event.discussion.node_id }}