Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

fix: suppress errors when fetching sticky #41

fix: suppress errors when fetching sticky

fix: suppress errors when fetching sticky #41

Workflow file for this run

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"]
})
}