FMHYedit/.github/workflows/labeler.yml

51 lines
1.4 KiB
YAML
Raw Normal View History

name: 'Pull Request Labeler'
on:
2024-06-03 07:14:46 +00:00
pull_request:
types: [opened, labeled, unlabeled]
jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Label PRs
uses: actions/labeler@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
2024-06-03 07:14:46 +00:00
auto-assign:
runs-on: ubuntu-latest
needs: triage
steps:
- name: Check if PR has 'core' label
id: check_label
uses: actions/github-script@v6
with:
script: |
const prNumber = context.payload.pull_request.number;
const labels = await github.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
});
const hasCoreLabel = labels.data.some(label => label.name === 'core');
return hasCoreLabel;
- name: Auto-assign to PR
if: steps.check_label.outputs.result == 'true'
uses: actions/github-script@v6
with:
2024-06-03 07:14:46 +00:00
script: |
const prNumber = context.payload.pull_request.number;
await github.issues.addAssignees({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: prNumber,
assignees: ['taskylizard'],
});