1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-25 23:21:33 +03:00

ci: Add/Drop labels on pull request activity and comment

When a pull request is opened/updated, add "please-review" and
remove a few other labels.

When a comment is made with /please-review on a PR. Add the
"please-review" label to the PR.
This commit is contained in:
Daan De Meyer 2022-12-08 16:25:03 +01:00 committed by Yu Watanabe
parent d20ea2c515
commit 8fc78e6845

View File

@ -6,6 +6,7 @@ name: "Pull Request Labeler"
on:
- pull_request_target
- issue_comment
permissions:
contents: read
@ -18,7 +19,46 @@ jobs:
pull-requests: write
steps:
- uses: actions/labeler@e54e5b338fbd6e6cdb5d60f51c22335fc57c401e
if: github.event_name == 'pull_request_target'
with:
repo-token: "${{ secrets.GITHUB_TOKEN }}"
configuration-path: .github/labeler.yml
sync-labels: "" # This is a workaround for issue 18671
- uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
if: github.event_name == 'pull_request_target'
with:
script: |
await github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["please-review"]
})
for (const label of ["reviewed/needs-rework 🔨",
"ci-fails/needs-rework 🔥",
"ci-failure-appears-unrelated"]) {
try {
await github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: label,
})
} catch (err) {
if (err.status != 404) {
throw err;
}
}
}
- uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0
if: github.event_name == 'issue_comment' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/please-review')
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["please-review"]
})