mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-11-12 13:38:32 +00:00
26edd98bf1
* Initial plan * Apply remaining changes Co-authored-by: ericfennis <11825403+ericfennis@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ericfennis <11825403+ericfennis@users.noreply.github.com>
104 lines
3.5 KiB
YAML
104 lines
3.5 KiB
YAML
name: PR title
|
|
|
|
on:
|
|
pull_request_target:
|
|
types:
|
|
- opened
|
|
- reopened
|
|
- synchronize
|
|
- edited
|
|
|
|
permissions: {}
|
|
|
|
concurrency:
|
|
group: pr-title-${{ github.event.pull_request.number }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
generate-pr-title:
|
|
name: Generate PR Title
|
|
# Skip when a maintainer has opted out by adding the "Keep PR title" label,
|
|
# and on manual edits so they are not reverted straight away.
|
|
if: github.repository == 'lucide-icons/lucide' &&
|
|
github.event.action != 'edited' &&
|
|
!contains(github.event.pull_request.labels.*.name, 'Keep PR title')
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: write # Required to edit the PR title
|
|
|
|
steps:
|
|
# We check out the main branch of the main repository for security reasons.
|
|
# The script only reads its input from the environment, so it never runs
|
|
# any code from the (untrusted) pull request.
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
repository: lucide-icons/lucide
|
|
fetch-depth: 0
|
|
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
|
|
with:
|
|
node-version-file: 'package.json'
|
|
|
|
- name: Get changed files
|
|
id: changed-files
|
|
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
|
|
with:
|
|
# The checkout is the base branch, so the PR head commit isn't available locally.
|
|
use_rest_api: true
|
|
|
|
- name: Generate PR title
|
|
id: generate
|
|
run: |
|
|
NEW_TITLE="$(node ./scripts/generatePullRequestTitle.mts)"
|
|
{
|
|
echo "new_title<<PR_TITLE_EOF"
|
|
echo "$NEW_TITLE"
|
|
echo "PR_TITLE_EOF"
|
|
} >> "$GITHUB_OUTPUT"
|
|
env:
|
|
ADDED_FILES: ${{ steps.changed-files.outputs.added_files }}
|
|
CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_and_modified_files }}
|
|
CURRENT_TITLE: ${{ github.event.pull_request.title }}
|
|
|
|
- name: Update PR title
|
|
if: steps.generate.outputs.new_title != ''
|
|
run: gh pr edit "$PR_NUMBER" --title "$NEW_TITLE"
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
NEW_TITLE: ${{ steps.generate.outputs.new_title }}
|
|
|
|
# Runs after the title is generated: an edit made with `GITHUB_TOKEN` does not
|
|
# trigger new workflow runs, so a separate workflow would lint the old title.
|
|
# The lint action fetches the current title through the API.
|
|
lint-pr-title:
|
|
name: PR Title Lint
|
|
needs: generate-pr-title
|
|
if: ${{ !cancelled() }}
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read # Required to read the PR title
|
|
|
|
steps:
|
|
# Checks out the base branch, so the allowed types can't be changed by the PR.
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- name: Read conventional commit types
|
|
id: commit-types
|
|
run: |
|
|
{
|
|
echo "types<<TYPES_EOF"
|
|
jq -r '.[]' .github/conventional-commit-types.json
|
|
echo "TYPES_EOF"
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
- uses: amannn/action-semantic-pull-request@48f256284bd46cdaab1048c3721360e808335d50 # v6.1.1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
types: ${{ steps.commit-types.outputs.types }}
|
|
requireScope: true
|
|
ignoreLabels: |
|
|
bot
|