Architecture diagrams: Propose solution for metadata generation in the data flow pipeline #4
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: Link issue to cross-repo milestone parent | |
| on: | |
| issues: | |
| types: [milestoned] | |
| jobs: | |
| link: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Link to parent issue in aind-scientific-computing | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.SERVICE_TOKEN }} | |
| script: | | |
| const issue = context.payload.issue; | |
| const milestone = issue.milestone; | |
| if (!milestone) return; | |
| const targetOwner = "AllenNeuralDynamics"; | |
| const targetRepo = "aind-scientific-computing"; | |
| const url = milestone.description; | |
| const match = url?.match(/\/issues\/(\d+)$/); | |
| if (!match) { | |
| console.log(`Milestone description is not a roadmap URL: ${url}`); | |
| return; | |
| } | |
| const parentNumber = parseInt(match[1]); | |
| const { data: parent } = await github.rest.issues.get({ | |
| owner: targetOwner, | |
| repo: targetRepo, | |
| issue_number: parentNumber | |
| }); | |
| if (!parent) { | |
| console.log(`No issue found at ${url}`); | |
| return; | |
| } | |
| await github.request("POST /repos/{owner}/{repo}/issues/{issue_number}/sub_issues", { | |
| owner: targetOwner, | |
| repo: targetRepo, | |
| issue_number: parentNumber, | |
| sub_issue_id: issue.id, | |
| headers: { | |
| "X-GitHub-Api-Version": "2022-11-28" | |
| } | |
| }); | |
| console.log(`Linked issue #${issue.number} as sub-issue of ${targetRepo}#${parentNumber}`); |