ci/request-review: init #5
Workflow file for this run
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: Request Review | |
| on: | |
| pull_request: | |
| types: [labeled] | |
| jobs: | |
| assign-reviewers: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const mapping = { | |
| "felbinger": ["FRR", "VyOS", "BIRD", "Mikrotik"], | |
| "peterablehmann": ["FRR", "VyOS", "BIRD", "JunOS"], | |
| "Vincentz-VP": ["Arista"], | |
| "GIC-de": ["RtBrick RBFS", "JunOS"], | |
| "dinoex": ["BIRD", "Nokia SR OS"], | |
| }; | |
| // transform mapping matrix, to platform to member mapping | |
| const mappingT = Object.entries(mapping).reduce((acc, [name, platforms]) => { | |
| platforms.forEach(platform => (acc[platform] = [...(acc[platform] || []), name])); | |
| return acc; | |
| }, {}); | |
| // get all labels from pull request | |
| const labels = context.payload.pull_request.labels.map(l => l.name.replace(/0\.platform:/, ""); | |
| for (const label of labels) { | |
| console.log(`PR contains ${label}, reviewers:`, mappingT[label]) | |
| // TODO request review | |
| } | |
| console.log(context); |