- Bump actions/checkout v4/v5 → v6, setup-node v4 → v6, setup-java v4 → v5, prek-action v1 → v2, github-script v6 → v7, aws-credentials v4 → v6, claude-code-action v1.0.89 → v1 - Add enable-cache: true to all astral-sh/setup-uv steps - Remove redundant uv venv --seed (uv sync creates venvs automatically) - Merge double uv sync steps in unit-tests into single conditional - Fix codeflash.yaml: broken path filter and working-directory - Consolidate duplicate publish jobs into a single matrix job - Remove generate_release_notes overridden by manual body
55 lines
1.7 KiB
YAML
55 lines
1.7 KiB
YAML
name: PR Labeler
|
|
|
|
on:
|
|
pull_request:
|
|
paths:
|
|
- ".github/workflows/**"
|
|
types: [opened, synchronize, reopened]
|
|
|
|
jobs:
|
|
label-workflow-changes:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
pull-requests: write
|
|
steps:
|
|
- name: Label PR with workflow changes
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const labelName = 'workflow-modified';
|
|
|
|
// Check if the label exists
|
|
try {
|
|
const labels = await github.rest.issues.listLabelsForRepo({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo
|
|
});
|
|
|
|
const labelExists = labels.data.some(label => label.name === labelName);
|
|
|
|
if (!labelExists) {
|
|
// Create the label if it doesn't exist
|
|
await github.rest.issues.createLabel({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
name: labelName,
|
|
color: 'f9d0c4',
|
|
description: 'This PR modifies GitHub Actions workflows'
|
|
});
|
|
console.log(`Label "${labelName}" created`);
|
|
} else {
|
|
console.log(`Label "${labelName}" already exists`);
|
|
}
|
|
} catch (error) {
|
|
console.error(`Failed to check or create label: ${error.message}`);
|
|
throw error;
|
|
}
|
|
|
|
// Add the label to the PR
|
|
await github.rest.issues.addLabels({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
labels: [labelName]
|
|
});
|
|
console.log(`Label "${labelName}" added to the PR.`);
|