feat: add language discipline rules from Orwell, Zinsser, and Ogilvy #29
Workflow file for this run
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] | ||
| push: | ||
| paths: | ||
| - '.github/workflows/label-external-issues.yml' | ||
| permissions: | ||
| issues: write | ||
| contents: read | ||
| jobs: | ||
| # Guard job to prevent workflow failure on push events | ||
| # GitHub Actions marks runs as failed when no jobs execute, so this ensures | ||
| # at least one job runs. Using explicit true condition for clarity. | ||
| validate: | ||
| if: ${{ true }} | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Workflow syntax valid | ||
| run: echo "Workflow file validated successfully" | ||
| 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/rjwalters/draftwell/discussions).` | ||
| }); | ||