Files
lucide/.github/workflows/comment-icon-preview.yml
Jakob Guddas 79fc531b30 ci(security): Pin sha actions (#4678)
* cd: pin actions

* fix: remove trailing whitespace in release.yml to pass prettier lint

Co-authored-by: ericfennis <11825403+ericfennis@users.noreply.github.com>

* Format code

---------

Co-authored-by: Eric Fennis <eric.fennis@gmail.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: ericfennis <11825403+ericfennis@users.noreply.github.com>
2026-08-07 11:31:26 +02:00

66 lines
2.2 KiB
YAML

name: Icon preview comment
on:
workflow_run:
workflows: ['Pull request icon preview']
types:
- completed
permissions: {}
jobs:
upload:
runs-on: ubuntu-latest
permissions:
contents: read
actions: read # Required to download the artifact from the triggering run
pull-requests: write
if: >
github.repository == 'lucide-icons/lucide' &&
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: 'Download artifact'
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr_number"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
const fs = require('fs');
fs.writeFileSync('${{github.workspace}}/pr_number.zip', Buffer.from(download.data));
- name: 'Unzip artifact'
run: unzip pr_number.zip
- name: 'Get PR number'
run: echo "number=$(cat NR)" >> $GITHUB_OUTPUT
id: pr-number
- name: Find Comment
uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4.0.0
id: pr-comment
with:
issue-number: ${{ steps.pr-number.outputs.number }}
comment-author: 'github-actions[bot]'
body-includes: Added or changed icons
- name: Create or update comment
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5.0.0
with:
comment-id: ${{ steps.pr-comment.outputs.comment-id }}
issue-number: ${{ steps.pr-number.outputs.number }}
body-path: comment-markup.md
edit-mode: replace