-
Notifications
You must be signed in to change notification settings - Fork 54
OSAC-3734: add label-gate workflow for merge queue #204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| --- | ||
| name: label-gate | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| on: | ||
| pull_request: | ||
| types: [opened, labeled, unlabeled, synchronize, reopened] | ||
| branches: [main] | ||
| merge_group: | ||
|
|
||
| jobs: | ||
| check-labels: | ||
| runs-on: ubuntu-latest | ||
|
Comment on lines
+13
to
+15
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "Repository files matching label-gate:"
fd -a 'label-gate\.yml$|label-gate\.yaml$' .github/workflows || true
if [ -f .github/workflows/label-gate.yml ]; then
echo
echo "File outline/stat:"
wc -l .github/workflows/label-gate.yml
echo
echo "Workflow contents:"
cat -n .github/workflows/label-gate.yml
fi
echo
echo "All workflow labels and concurrency settings nearby:"
rg -n "label-gate|pull_request|pull_request_target|concurrency|labels|GITHUB_TOKEN|permissions:" .github/workflows || trueRepository: osac-project/osac Length of output: 28462 Serialize label-gate runs per pull request.
🤖 Prompt for AI Agents |
||
| steps: | ||
| - name: Auto-pass for merge queue | ||
| if: github.event_name == 'merge_group' | ||
| run: echo "Labels already validated on PR" | ||
| - name: Check required Prow labels | ||
| if: github.event_name == 'pull_request' | ||
| env: | ||
| LABELS: ${{ toJSON(github.event.pull_request.labels.*.name) }} | ||
| run: | | ||
| missing=() | ||
| for label in lgtm approved jira/valid-reference; do | ||
| if ! echo "$LABELS" | jq -e "index(\"$label\")" > /dev/null 2>&1; then | ||
| missing+=("$label") | ||
| fi | ||
| done | ||
| if [[ ${#missing[@]} -gt 0 ]]; then | ||
| echo "::error::Missing required labels: ${missing[*]}" | ||
| echo "" | ||
| echo "Required labels are set by Prow plugins via OWNERS files:" | ||
| echo " lgtm - reviewer types /lgtm" | ||
| echo " approved - approver types /approve" | ||
| echo " jira/valid-reference - PR title has valid Jira key" | ||
| exit 1 | ||
| fi | ||
| echo "All required labels present" | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: osac-project/osac
Length of output: 2067
Remove the unused
contents: readpermission.This workflow only reads GitHub event data with
github.eventandjq; it does not checkout the repository or call the GitHub API. Setcontents: noneor omit the explicit permission block to keepGITHUB_TOKENpermissions minimal.Proposed permission change
📝 Committable suggestion
🤖 Prompt for AI Agents
Source: Path instructions