Support aspect template for Python #757
This file contains 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: Auto Add Labels and Assignees | |
on: | |
pull_request_target: | |
types: ["opened", "reopened", "ready_for_review"] | |
jobs: | |
add_label: | |
permissions: | |
contents: read | |
pull-requests: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/labeler@v5 | |
if: ${{ github.event.pull_request.draft == false }} | |
add_assignee: | |
runs-on: ubuntu-latest | |
needs: add_label | |
permissions: | |
contents: read | |
pull-requests: write | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set Assignees | |
uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
result-encoding: string | |
retries: 3 | |
retry-exempt-status-codes: 400,401 | |
script: | | |
let issue_number = context.payload.pull_request.number; | |
const labels = (await github.rest.issues.listLabelsOnIssue({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
})).data.map(label => label.name); | |
const assignees = []; | |
const labelsToAssignees = { | |
'product: CLion': ['ujohnny'], | |
'product: IntelliJ': ['mai93'], | |
'product: GoLand': ['tpasternak'], | |
'product: Android Studio': ['mai93'], | |
'product: PyCharm': ['mai93'] | |
}; | |
for (const label of labels) { | |
if (label in labelsToAssignees) { | |
assignees.push(...labelsToAssignees[label]); | |
} | |
} | |
if (assignees.length > 0) { | |
await github.rest.issues.addAssignees({ | |
issue_number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
assignees | |
}); | |
} |