Add Guideflows to feature pages #467
Workflow file for this run
This file contains hidden or 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: Block PRs with specific labels | |
on: | |
pull_request: | |
types: [opened, labeled, unlabeled, synchronize] | |
branches: | |
- main | |
- next | |
push: | |
branches: | |
- main | |
- next | |
jobs: | |
check-labels: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check for blocking labels | |
id: check_labels | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
// Define blocking labels | |
const blockingLabels = ["flag: don't merge", "flag: merge pending release"]; | |
// Check if this is a pull request event | |
if (context.payload.pull_request) { | |
const { data: labels } = await github.rest.issues.listLabelsOnIssue({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number | |
}); | |
const labelNames = labels.map(label => label.name); | |
const blockedLabels = labelNames.filter(label => | |
blockingLabels.includes(label.toLowerCase()) | |
); | |
if (blockedLabels.length > 0) { | |
core.setFailed(`PR cannot be merged because it has the following blocking labels: ${blockedLabels.join(', ')}`); | |
return; | |
} | |
console.log('No blocking labels found, PR can be merged'); | |
} else { | |
// If this is a direct push, allow it to pass without checking | |
console.log('This is a direct push event, not a PR. Skipping label check.'); | |
} |