Skip to content

Commit

Permalink
feat(tools): autoclose open answered discussions (#948)
Browse files Browse the repository at this point in the history
  • Loading branch information
jpvajda authored Oct 4, 2024
1 parent 75ec935 commit babf43b
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 686 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/blog-post-workflow.yml

This file was deleted.

58 changes: 58 additions & 0 deletions .github/workflows/close-answered-discussions.yml
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
});
}
}
32 changes: 0 additions & 32 deletions .github/workflows/orbit-stats.yml

This file was deleted.

47 changes: 47 additions & 0 deletions .gitignore
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
3 changes: 0 additions & 3 deletions actions/orbit-stats/.gitignore

This file was deleted.

5 changes: 0 additions & 5 deletions actions/orbit-stats/action.yml

This file was deleted.

118 changes: 0 additions & 118 deletions actions/orbit-stats/index.js

This file was deleted.

Loading

0 comments on commit babf43b

Please sign in to comment.