name: Process Created Issue on: issues: types: - opened jobs: issue-automation: permissions: contents: read # to fetch code (actions/checkout) issues: write # to comment and add labels to issues # Only the forms that ask for a reproduction URL need processing if: >- ${{ contains(github.event.issue.labels.*.name, 'kind/bug 🐞') && ( contains(github.event.issue.labels.*.name, 'area/ui') || contains(github.event.issue.labels.*.name, 'area/cli') ) }} runs-on: ubuntu-latest env: # Mimic ternary operator, see https://github.com/actions/runner/issues/409#issuecomment-752775072 TEMPLATE_AREA: ${{ contains(github.event.issue.labels.*.name, 'area/ui') && 'ui' || 'cli' }} steps: - uses: actions/checkout@v6 - uses: stefanbuck/github-issue-parser@v3 id: issue-parser with: template-path: .github/ISSUE_TEMPLATE/bug-report--${{ env.TEMPLATE_AREA }}.yml - uses: actions/github-script@v8 env: ISSUE_MODEL: ${{ steps.issue-parser.outputs.jsonString }} INVALID_REPRO_MESSAGE: | Hi @${{ github.event.issue.user.login }}! 👋 It looks like you provided an invalid or unsupported reproduction URL. Do not use any service other than [Codepen](https://codepen.quasar.dev), [jsFiddle](https://jsfiddle.quasar.dev), [StackBlitz](https://stackblitz.quasar.dev), [CodeSandbox](https://codesandbox.quasar.dev), and [GitHub](https://github.com). Make sure the URL you provided is correct and reachable. You can test it by visiting it in a private tab, another device, etc. Please **edit your original post above** and provide a valid reproduction URL as explained. Without a proper reproduction, your issue will have to get closed. Thank you for your collaboration. 👏 with: script: | const issueModel = JSON.parse(process.env.ISSUE_MODEL); let label = 'bug/1-repro-available'; try { const reproURL = new URL(issueModel['repro-url']); if (reproURL.protocol !== 'https:') { throw new Error(); } switch (reproURL.hostname) { case 'codepen.io': if (/^\/.+\/(pen|project)\/.+$/.test(reproURL.pathname)) { break; } case 'jsfiddle.net': if (/^\/.+$/.test(reproURL.pathname)) { break; } case 'stackblitz.com': if (/^\/edit\/.+$/.test(reproURL.pathname)) { break; } case 'codesandbox.io': if (/^\/s\/.+$/.test(reproURL.pathname)) { break; } case 'github.com': if (/^\/.+\/.+$/.test(reproURL.pathname)) { break; } default: throw new Error(); } } catch { label = 'bug/0-needs-info'; } await github.rest.issues.addLabels({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, labels: [label] }); if (label === 'bug/0-needs-info') { await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, body: process.env.INVALID_REPRO_MESSAGE }); }