mirror of
https://github.com/neovim/neovim.git
synced 2026-07-31 04:39:07 +00:00
Bumps the github-actions group with 1 update in the / directory: [actions/checkout](https://github.com/actions/checkout). Updates `actions/checkout` from 7.0.0 to 7.0.1 - [Release notes](https://github.com/actions/checkout/releases) - [Commits](https://github.com/actions/checkout/compare/v7...v7.0.1) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 7.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions ... Signed-off-by: dependabot[bot] <support@github.com>
96 lines
3.0 KiB
YAML
96 lines
3.0 KiB
YAML
name: "label-pr"
|
|
on:
|
|
pull_request_target:
|
|
types: [opened, synchronize, reopened, ready_for_review]
|
|
|
|
permissions: {}
|
|
|
|
jobs:
|
|
label:
|
|
if: github.event.action == 'opened'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write
|
|
steps:
|
|
- uses: actions/checkout@v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
|
|
- name: "changed-files"
|
|
uses: actions/labeler@v7.0.0
|
|
with:
|
|
configuration-path: .github/scripts/labeler_configuration.yml
|
|
|
|
# Scope GITHUB_TOKEN to this step only, avoid exposing to 3P `actions/labeler`.
|
|
- name: "guess type/scope from title"
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GH_REPO: ${{ github.repository }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
PR_TITLE: ${{ github.event.pull_request.title }}
|
|
run: |
|
|
gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|([[:alpha:]]+)(\(.*\))?!?:.*|\1|')" || true
|
|
gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+\((.+)\)!?:.*|\1|')" || true
|
|
gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+(\(.*\))?!:.*|breaking-change|')" || true
|
|
|
|
- name: "target:release"
|
|
if: startsWith(github.base_ref, 'release')
|
|
uses: actions/github-script@v9
|
|
with:
|
|
script: |
|
|
github.rest.issues.addLabels({
|
|
issue_number: context.issue.number,
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
labels: ['target:release']
|
|
})
|
|
|
|
ai-assisted:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
pull-requests: write
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GH_REPO: ${{ github.repository }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
AI_LABEL: 'AI assisted 🤖'
|
|
steps:
|
|
- name: "Label PRs with disclosed AI-assisted commits"
|
|
shell: bash
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
commit_messages=$(gh api "repos/$GH_REPO/pulls/$PR_NUMBER/commits" --paginate --jq '.[].commit.message')
|
|
|
|
has_ai_disclosure=false
|
|
for pattern in \
|
|
'^(AI|LLM|GPT)([ -][A-Za-z-]+)?: *.+' \
|
|
'supported +by +AI' \
|
|
'^Co-authored(-| +)by: .*(Claude|Codex|Copilot|Cursor|Gemini|Aider|Cline|Windsurf|OpenAI|OpenCode|Amp|Anthropic|GPT)'; do
|
|
if grep -Eiq "$pattern" <<< "$commit_messages"; then
|
|
has_ai_disclosure=true
|
|
break
|
|
fi
|
|
done
|
|
|
|
if [[ "$has_ai_disclosure" == false ]]; then
|
|
# No supported AI disclosure found in commits
|
|
exit 0
|
|
fi
|
|
|
|
pr_labels=$(gh pr view "$PR_NUMBER" --json labels --jq '.labels[].name')
|
|
if grep -Fxq "$AI_LABEL" <<< "$pr_labels"; then
|
|
# Already has label
|
|
exit 0
|
|
fi
|
|
|
|
gh pr edit "$PR_NUMBER" --add-label "$AI_LABEL"
|
|
|
|
request-reviewer:
|
|
if: github.event.action == 'opened'
|
|
needs: label
|
|
permissions:
|
|
pull-requests: write
|
|
uses: ./.github/workflows/reviewers_add.yml
|