Skip to content

Shortcut 6757: acquisition filter #287

Shortcut 6757: acquisition filter

Shortcut 6757: acquisition filter #287

Workflow file for this run

name: Label PRs with skip-sc
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
apply-skip-sc-label:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Add skip-sc label if author is in the list and branch starts with sc-
uses: actions/github-script@v7
with:
script: |
const pr = context.payload.pull_request;
const prAuthor = pr.user.login;
const branchName = pr.head.ref;
const relevantUsers = ['swalker2m'];
const skipScLabel = 'skip-sc';
if (!branchName.startsWith('sc-')) {
console.log(`Branch '${branchName}' does not start with 'sc-'; skipping.`);
return;
}
if (!relevantUsers.includes(prAuthor)) {
console.log(`PR author '${prAuthor}' not in the list; skipping.`);
return;
}
const labels = pr.labels.map(l => l.name);
if (!labels.includes(skipScLabel)) {
await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: pr.number,
labels: [skipScLabel],
});
console.log(`Added label "${skipScLabel}" to PR #${pr.number}`);
} else {
console.log(`Label "${skipScLabel}" already present on PR #${pr.number}`);
}