Add auto-mutate checkbox to progress bar UI #143
This file contains hidden or 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: Label external issues | ||
| on: | ||
| issues: | ||
| types: [opened] | ||
| permissions: | ||
| issues: write | ||
| contents: read | ||
| jobs: | ||
| label_external: | ||
| if: github.event_name == 'issues' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Check if author is a collaborator | ||
| id: check | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| const { owner, repo } = context.repo; | ||
| const username = context.payload.issue.user.login; | ||
| try { | ||
| await github.rest.repos.checkCollaborator({ | ||
| owner, | ||
| repo, | ||
| username | ||
| }); | ||
| console.log(`${username} is a collaborator`); | ||
| return { isCollaborator: true }; | ||
| } catch (error) { | ||
| console.log(`${username} is NOT a collaborator`); | ||
| return { isCollaborator: false }; | ||
| } | ||
| - name: Add 'external' label if not a collaborator | ||
| if: fromJSON(steps.check.outputs.result).isCollaborator == false | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| await github.rest.issues.addLabels({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| labels: ['external'] | ||
| }); | ||
| - name: Post welcome comment on external issues | ||
| if: fromJSON(steps.check.outputs.result).isCollaborator == false | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: context.issue.number, | ||
| body: `Thank you for submitting an issue! 🙏 | ||
| This issue has been automatically labeled as \`external\` and will be reviewed by the maintainers. | ||
| **Note**: External issues require manual triage before being assigned. We appreciate your patience while we review your submission. | ||
| For questions or discussions, please use [GitHub Discussions](https://github.com/rulehunt/rulehunt/discussions).` | ||
| }); | ||