Optimize share not working anymore #58
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
name: Contribution Bot | |
on: | |
issues: | |
types: [opened] | |
jobs: | |
auto-assign: | |
runs-on: ubuntu-latest | |
permissions: | |
issues: write | |
steps: | |
- name: 'Check Author' | |
uses: actions/github-script@v7 | |
id: check-author | |
with: | |
github-token: ${{ secrets.ACCESS_TOKEN }} | |
debug: true | |
script: | | |
const { owner } = context.repo; | |
const author = context.payload.sender.login; | |
const maintainers = await github.rest.teams.listMembersInOrg({ | |
org: owner, | |
team_slug: 'digiwf_maintainer' | |
}); | |
const devs = await github.rest.teams.listMembersInOrg({ | |
org: owner, | |
team_slug: 'digiwf_dev' | |
}); | |
const admins = await github.rest.teams.listMembersInOrg({ | |
org: owner, | |
team_slug: 'digiwf_admin' | |
}); | |
const coreMembers = maintainers.data.concat(devs.data, admins.data).map(u => u.login) | |
console.log(author) | |
console.log(coreMembers) | |
console.log(coreMembers.includes(author)) | |
return coreMembers.includes(author) | |
- name: 'Assign Issue' | |
uses: actions/github-script@v7 | |
if: steps.check-author.outputs.result != 'true' | |
with: | |
github-token: ${{ secrets.ACCESS_TOKEN }} | |
debug: true | |
script: | | |
const { repo, owner } = context.repo; | |
const issue_number = context.issue.number; | |
const maintainers = await github.rest.teams.listMembersInOrg({ | |
org: owner, | |
team_slug: 'digiwf_maintainer' | |
}); | |
await github.rest.issues.addAssignees({ | |
owner, | |
repo, | |
issue_number, | |
assignees: maintainers.data.map(u => u.login) | |
}); | |
- name: 'Inform Author' | |
uses: actions/github-script@v7 | |
if: steps.check-author.outputs.result != 'true' | |
with: | |
debug: true | |
script: | | |
const { repo, owner } = context.repo; | |
const issue_number = context.issue.number; | |
await github.rest.issues.createComment({ | |
issue_number, | |
owner, | |
repo, | |
body: '👋 Thanks for reporting! The maintainers have been notified and will get back to you.' | |
}); |