create-issue #5
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: Create Issue from User Report | |
| on: | |
| repository_dispatch: | |
| types: [create-issue] | |
| permissions: | |
| issues: write | |
| jobs: | |
| create-issue: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Create Issue | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const { type, description, user_agent, timestamp } = context.payload.client_payload; | |
| const title = `[${type === 'bug' ? 'Bug Report' : 'Feature Request'}] User submitted report`; | |
| const labels = type === 'bug' ? ['bug', 'user-reported'] : ['enhancement', 'user-reported']; | |
| const body = `## Type | |
| ${type === 'bug' ? '🐛 Bug Report' : '✨ Feature Request'} | |
| ## Description | |
| ${description} | |
| ## Metadata | |
| - **Submitted at:** ${timestamp} | |
| - **User Agent:** ${user_agent} | |
| --- | |
| *This issue was automatically created from a user submission via the web form.*`; | |
| await github.rest.issues.create({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| title: title, | |
| body: body, | |
| labels: labels | |
| }); |