-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(tools): autoclose open answered discussions (#948)
- Loading branch information
Showing
9 changed files
with
105 additions
and
686 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,58 @@ | ||
name: Close Answered Discussions | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * 1" # Runs every Monday at midnight | ||
|
||
jobs: | ||
close-answered-discussions: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Close Answered Discussions | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.DISCUSSIONS_CLOSER }} | ||
script: | | ||
const { graphql } = github; | ||
const query = `{ | ||
repository(owner: "deepgram", name: "community") { | ||
discussions(first: 100, states: [OPEN]) { | ||
nodes { | ||
id | ||
title | ||
number | ||
isAnswered | ||
url | ||
} | ||
} | ||
} | ||
}`; | ||
const result = await graphql(query, { | ||
headers: { | ||
authorization: `token ${{ secrets.DISCUSSIONS_CLOSER }}` | ||
} | ||
}); | ||
// Loop through the discussions and close the ones marked as answered | ||
for (const discussion of result.repository.discussions.nodes) { | ||
if (discussion.isAnswered) { | ||
console.log(`Closing answered discussion: ${discussion.title} (${discussion.url})`); | ||
await graphql(` | ||
mutation($id: ID!) { | ||
closeDiscussion(input: {discussionId: $id}) { | ||
discussion { | ||
title | ||
} | ||
} | ||
} | ||
`, { | ||
headers: { | ||
authorization: `token ${{ secrets.DISCUSSIONS_CLOSER }}` | ||
}, | ||
id: discussion.id | ||
}); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,47 @@ | ||
# Ignore logs and temporary files | ||
*.log | ||
*.tmp | ||
*.bak | ||
*.swp | ||
*.swo | ||
|
||
# Ignore node_modules if using JavaScript/Node.js actions | ||
node_modules/ | ||
|
||
# Ignore Python virtual environment if using Python actions | ||
venv/ | ||
.env/ | ||
|
||
# Ignore compiled language files | ||
*.class | ||
*.o | ||
*.out | ||
*.so | ||
|
||
# Ignore build artifacts | ||
dist/ | ||
build/ | ||
coverage/ | ||
__pycache__/ | ||
*.pyc | ||
*.pyo | ||
|
||
# Ignore Docker-related files | ||
.dockerignore | ||
docker-compose.override.yml | ||
docker-compose.yml | ||
.DS_Store | ||
|
||
# Ignore any specific GitHub Action cache or temporary files | ||
.github/workflows/cache/ | ||
.github/actions/cache/ | ||
.github/workflows/*.log | ||
.github/actions/*.log | ||
|
||
# Ignore custom sensitive or environment-specific files | ||
secrets.env | ||
.secrets | ||
.env.local | ||
|
||
# Ignore macOS system files | ||
.DS_Store |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.