This repository has been archived by the owner on Sep 12, 2024. It is now read-only.
sync upstream #36
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: "Pull Request Labeller" | |
on: | |
pull_request_target: | |
types: | |
- closed | |
- opened | |
- reopened | |
- synchronize | |
- converted_to_draft | |
- ready_for_review | |
- review_requested | |
- review_request_removed | |
jobs: | |
label: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const prNumber = context.issue.number; | |
const pull = await github.rest.pulls.get({ | |
owner: context.payload.repository.owner.login, | |
repo: context.payload.repository.name, | |
pull_number: context.issue.number | |
}); | |
if (pull.data.state === "closed") { | |
if (pull.data.merged) { | |
await github.rest.issues.setLabels({ | |
owner: context.payload.repository.owner.login, | |
repo: context.payload.repository.name, | |
issue_number: context.issue.number, | |
labels: ["✅ pull: accepted"] | |
}) | |
} | |
else { | |
await github.rest.issues.setLabels({ | |
owner: context.payload.repository.owner.login, | |
repo: context.payload.repository.name, | |
issue_number: context.issue.number, | |
labels: ["❌ pull: rejected"] | |
}) | |
} | |
} else if (pull.data.draft) { | |
await github.rest.issues.setLabels({ | |
owner: context.payload.repository.owner.login, | |
repo: context.payload.repository.name, | |
issue_number: context.issue.number, | |
labels: ["⚒️ pull: work in progress"] | |
}) | |
} else { | |
await github.rest.issues.setLabels({ | |
owner: context.payload.repository.owner.login, | |
repo: context.payload.repository.name, | |
issue_number: context.issue.number, | |
labels: ["🔍 pull: ready for review"] | |
}) | |
} |