From ddcb19353dc675b2a67b5ace1f4e6ef63c11bd3f Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Wed, 7 Aug 2024 15:03:46 -0700 Subject: [PATCH] Add round-robin issue assigner (#1650) * Add round-robin issue assigner * Missed Adam --- .github/workflows/round-robin.yml | 79 +++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 .github/workflows/round-robin.yml diff --git a/.github/workflows/round-robin.yml b/.github/workflows/round-robin.yml new file mode 100644 index 000000000..b34cbc71b --- /dev/null +++ b/.github/workflows/round-robin.yml @@ -0,0 +1,79 @@ +name: round-robin +permissions: + issues: write + +on: + issues: + types: [opened] + +jobs: + assignIssue: + name: Assign Issue to Someone + runs-on: ubuntu-latest + if: github.repository == 'microsoft/debugpy && github.event.action == 'opened' && !contains( github.event.issue.labels.*.name, 'skip-reassign') + steps: + - name: Find last assigned + id: assigned + uses: actions/github-script@v6.3.3 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + result-encoding: string + script: | + const issue = await github.rest.issues.get({ + issue_number: 1649, + owner: context.repo.owner, + repo: context.repo.repo + }); + return issue.data.assignees[0].login || ''; + - name: Dump last assigned + env: + LAST_ASSIGNED: ${{ steps.assigned.outputs.result }} + run: echo "$LAST_ASSIGNED" + - uses: lee-dohm/team-rotation@v1 + with: + last: ${{ steps.assigned.outputs.result }} + include: AdamYoblick bschnurr debonte heejaechang StellaHuang95 rchiodo KacieKK judej + id: rotation + - name: Dump next in rotation + env: + NEXT_ROTATION: ${{ steps.rotation.outputs.next }} + run: echo "$NEXT_ROTATION" + - name: Assign to next person + uses: actions/github-script@v6.3.3 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.issues.addAssignees({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + assignees: ['${{ steps.rotation.outputs.next }}'] + }) + - name: Give it the label 'needs repro' + uses: actions/github-script@v6.3.3 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['needs repro'] + }) + - name: Save assignment to state + uses: actions/github-script@v6.3.3 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + await github.rest.issues.removeAssignees({ + issue_number: 1649, + owner: context.repo.owner, + repo: context.repo.repo, + assignees: ['${{ steps.assigned.outputs.result }}'] + }); + github.rest.issues.addAssignees({ + issue_number: 1649, + owner: context.repo.owner, + repo: context.repo.repo, + assignees: ['${{ steps.rotation.outputs.next }}'] + }) \ No newline at end of file