Add zoomable interactive wrappers for indexed and time-series charts #3
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: Issue Intake | |
| on: | |
| issues: | |
| types: | |
| - opened | |
| - reopened | |
| - transferred | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| issues: write | |
| jobs: | |
| route-issue: | |
| runs-on: ubuntu-latest | |
| env: | |
| PROJECT_ID: PVT_kwDOBH1sx84BRMRS | |
| PROJECT_URL: https://github.com/orgs/ImpostersLimited/projects/5 | |
| PROJECT_TOKEN: ${{ secrets.IMPOSTERSLIMITED_PROJECT_AUTOMATION_TOKEN }} | |
| steps: | |
| - name: Collect target issues | |
| id: collect | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ github.token }} | |
| script: | | |
| let issues = [] | |
| if (context.eventName === 'workflow_dispatch') { | |
| const openIssues = await github.paginate(github.rest.issues.listForRepo, { | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| state: 'open', | |
| per_page: 100, | |
| }) | |
| issues = openIssues | |
| .filter(issue => !issue.pull_request) | |
| .map(issue => ({ number: issue.number, node_id: issue.node_id })) | |
| core.info(`Collected ${issues.length} open issues for manual backfill`) | |
| } else { | |
| issues = [{ | |
| number: context.payload.issue.number, | |
| node_id: context.payload.issue.node_id, | |
| }] | |
| core.info(`Collected issue #${context.payload.issue.number} from ${context.eventName}`) | |
| } | |
| core.setOutput('issues', JSON.stringify(issues)) | |
| core.setOutput('count', String(issues.length)) | |
| - name: Assign issues to andywkff | |
| if: ${{ steps.collect.outputs.count != '0' }} | |
| uses: actions/github-script@v7 | |
| env: | |
| TARGET_ISSUES: ${{ steps.collect.outputs.issues }} | |
| with: | |
| github-token: ${{ github.token }} | |
| script: | | |
| const issues = JSON.parse(process.env.TARGET_ISSUES) | |
| for (const issue of issues) { | |
| await github.rest.issues.addAssignees({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issue.number, | |
| assignees: ['andywkff'], | |
| }) | |
| core.info(`Assigned issue #${issue.number} to andywkff`) | |
| } | |
| - name: Add issues to ImpostersLimited Main project | |
| if: ${{ env.PROJECT_TOKEN != '' && steps.collect.outputs.count != '0' }} | |
| uses: actions/github-script@v7 | |
| env: | |
| TARGET_ISSUES: ${{ steps.collect.outputs.issues }} | |
| with: | |
| github-token: ${{ env.PROJECT_TOKEN }} | |
| script: | | |
| const projectId = process.env.PROJECT_ID | |
| const projectUrl = process.env.PROJECT_URL | |
| const issues = JSON.parse(process.env.TARGET_ISSUES) | |
| const failures = [] | |
| for (const issue of issues) { | |
| try { | |
| await github.graphql( | |
| `mutation($projectId: ID!, $contentId: ID!) { | |
| addProjectV2ItemById(input: { projectId: $projectId, contentId: $contentId }) { | |
| item { id } | |
| } | |
| }`, | |
| { projectId, contentId: issue.node_id } | |
| ) | |
| core.info(`Added issue #${issue.number} to ${projectUrl}`) | |
| } catch (error) { | |
| const message = String(error?.message ?? error) | |
| if ( | |
| message.includes('already exists') || | |
| message.includes('already added') || | |
| message.includes('already in the project') | |
| ) { | |
| core.info(`Issue #${issue.number} is already in ${projectUrl}`) | |
| continue | |
| } | |
| failures.push(`#${issue.number}: ${message}`) | |
| } | |
| } | |
| if (failures.length > 0) { | |
| core.setFailed(`Failed to add some issues to ${projectUrl}\n${failures.join('\n')}`) | |
| } | |
| - name: Warn when project token is not configured | |
| if: ${{ env.PROJECT_TOKEN == '' && steps.collect.outputs.count != '0' }} | |
| run: | | |
| echo "::warning title=Missing project automation token::Set the IMPOSTERSLIMITED_PROJECT_AUTOMATION_TOKEN org secret to enable automatic project placement." |