[BUG] testing report form #1
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: Transfer Bug Report to Sovereign Network | |
| on: | |
| issues: | |
| types: [opened] | |
| jobs: | |
| transfer-issue: | |
| runs-on: ubuntu-latest | |
| # Only run if the issue has the "bug" label (set by the form) | |
| if: contains(github.event.issue.labels.*.name, 'bug') | |
| steps: | |
| - name: Create issue in The-Sovereign-Network repo | |
| id: create_issue | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.PRIVATE_REPO_TOKEN }} | |
| script: | | |
| const issue = context.payload.issue; | |
| const body = [ | |
| `> **Transferred from public intake:** ${context.payload.repository.full_name}#${issue.number}`, | |
| `> **Submitted by:** @${issue.user.login}`, | |
| `> **Original URL:** ${issue.html_url}`, | |
| ``, | |
| issue.body | |
| ].join('\n'); | |
| const result = await github.rest.issues.create({ | |
| owner: 'SOVEREIGN-NET', | |
| repo: 'The-Sovereign-Network', | |
| title: issue.title, | |
| body: body, | |
| labels: ['bug', 'triage', 'from-public'], | |
| }); | |
| core.setOutput('issue_node_id', result.data.node_id); | |
| core.setOutput('issue_url', result.data.html_url); | |
| - name: Add issue to Project board #5 | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.PRIVATE_REPO_TOKEN }} | |
| script: | | |
| // Step 1: get the project node ID | |
| const projectQuery = await github.graphql(` | |
| query { | |
| organization(login: "SOVEREIGN-NET") { | |
| projectV2(number: 5) { | |
| id | |
| } | |
| } | |
| } | |
| `); | |
| const projectId = projectQuery.organization.projectV2.id; | |
| // Step 2: add the issue to the project | |
| await github.graphql(` | |
| mutation($projectId: ID!, $contentId: ID!) { | |
| addProjectV2ItemById(input: { projectId: $projectId, contentId: $contentId }) { | |
| item { id } | |
| } | |
| } | |
| `, { | |
| projectId, | |
| contentId: '${{ steps.create_issue.outputs.issue_node_id }}' | |
| }); | |
| core.info('Issue added to Project #5'); | |
| - name: Comment on public issue and close it | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const issueNumber = context.payload.issue.number; | |
| const trackerUrl = '${{ steps.create_issue.outputs.issue_url }}'; | |
| // Thank the reporter and confirm receipt | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issueNumber, | |
| body: [ | |
| '### Thank you for your bug report!', | |
| '', | |
| 'Your report has been received and added to our tracker for triage.', | |
| '', | |
| 'A member of the team will review it shortly. You will be notified here if we need more information.', | |
| '', | |
| '_This issue has been closed here to keep this public repo clean. Your report is **not** lost._' | |
| ].join('\n') | |
| }); | |
| // Label as transferred | |
| await github.rest.issues.addLabels({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issueNumber, | |
| labels: ['transferred'] | |
| }); | |
| // Close the public issue | |
| await github.rest.issues.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issueNumber, | |
| state: 'closed', | |
| state_reason: 'not_planned' | |
| }); | |
| // Lock to prevent further comments | |
| await github.rest.issues.lock({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issueNumber, | |
| lock_reason: 'resolved' | |
| }); |