Files
lucide/.github/workflows/pull-request-missing-issue.yml

83 lines
3.1 KiB
YAML

name: Pull request missing issue
on:
pull_request_target:
types:
- opened
- edited
- synchronize
- ready_for_review
paths:
- 'icons/*.svg'
permissions: {}
# Two events landing close together (a push right after opening) would
# otherwise both find no existing comment and post one each.
concurrency:
group: missing-issue-${{ github.event.number }}
cancel-in-progress: true
jobs:
pull-request-missing-issue:
name: Pull Request Missing Issue
if: github.repository == 'lucide-icons/lucide' && github.event.pull_request.draft == false
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write # Required to post and update the comment on the pull request
steps:
# We checkout the main branch of main repository for security reasons.
# The script never runs code from the pull request, it only reads the
# pull request's icons through the GitHub API.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: lucide-icons/lucide
- uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 # v6.0.10
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
cache: 'pnpm'
node-version-file: 'package.json'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Generate comment markup
id: markup
run: node ./scripts/generateMissingIssueComment.mts
env:
PULL_REQUEST_NUMBER: ${{ github.event.number }}
COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Find comment
uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4.0.0
id: pr-comment
with:
issue-number: ${{ github.event.number }}
comment-author: 'github-actions[bot]'
body-includes: lucide-missing-issue-comment
- name: Post missing issue comment
if: steps.markup.outputs.action == 'nag'
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
comment-id: ${{ steps.pr-comment.outputs.comment-id }}
issue-number: ${{ github.event.number }}
body-path: missing-issue-comment.md
edit-mode: replace
# Linking an issue from the pull request's Development sidebar fires no
# event, so the comment resolves on the next edit or push instead.
- name: Resolve missing issue comment
if: steps.markup.outputs.action == 'resolve' && steps.pr-comment.outputs.comment-id != ''
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
comment-id: ${{ steps.pr-comment.outputs.comment-id }}
issue-number: ${{ github.event.number }}
body: |
<!-- lucide-missing-issue-comment -->
Thanks for linking an issue for this icon design! ✅
edit-mode: replace