🤖 Bump tj-actions/changed-files from 44 to 45 #37
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: Assign author to PR | |
on: | |
pull_request: | |
types: | |
- opened | |
permissions: | |
issues: write | |
pull-requests: write | |
concurrency: | |
group: ${{github.workflow}}-${{github.ref}} | |
cancel-in-progress: true | |
jobs: | |
assign-author-to-pr: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/github-script@v7 | |
with: | |
script: | | |
const owner = context.repo.owner; | |
const repo = context.repo.repo; | |
const issue_number = context.issue.number; | |
const author = context.payload.pull_request.user.login; | |
if (author.includes("bot")) { | |
core.info(`Cannot add bot account (${author}) as assignee`); | |
return; | |
} | |
const assignmentResult = await github.rest.issues.addAssignees({ | |
owner, | |
repo, | |
issue_number, | |
assignees: [author], | |
}); | |
core.debug(JSON.stringify(assignmentResult)); | |
core.info(`@${author} has been assigned to the pull request: #${context.issue.number}`); | |
const assigneesResult = await github.rest.issues.listAssignees({ | |
owner, | |
repo, | |
issue_number | |
}); | |
core.debug(JSON.stringify(assigneesResult)); | |
core.info(`Assignees for PR: ${JSON.stringify(assigneesResult.data.map(({login}) => login))}`); |