From 73f70c885ac8b79a41d6b1400c6fcb773d1b7691 Mon Sep 17 00:00:00 2001 From: Eric Fennis Date: Wed, 13 Dec 2023 22:28:05 +0100 Subject: [PATCH] Update pull-request.yml --- .github/workflows/pull-request.yml | 34 ++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 210c167a99..d995ef3fbe 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -7,7 +7,11 @@ on: jobs: lint-contributors: + if: github.repository == 'lucide-icons/lucide' runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write steps: - uses: actions/checkout@v3 with: @@ -24,7 +28,8 @@ jobs: - env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} FETCH_DEPTH: ${{ github.event.pull_request.commits }} - run: node ./scripts/updateContributors.mjs ${{ steps.changed-files.outputs.all_changed_files }} + CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} + run: node ./scripts/updateContributors.mjs "$CHANGED_FILES" - name: Generate annotations env: ANNOTATION_SEVERITY: notice @@ -43,6 +48,7 @@ jobs: # run: git diff --exit-code -- icons/*.json add-changed-icons-comment: + if: github.repository == 'lucide-icons/lucide' runs-on: ubuntu-latest permissions: pull-requests: write @@ -59,16 +65,18 @@ jobs: files: icons/*.svg - name: Generate 24px dpi preview id: generate-24px-dpi-preview + env: + CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} run: | delimiter="$(openssl rand -hex 8)" echo "body<<$delimiter" >> $GITHUB_OUTPUT - for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + while IFS= read -r file; do cat "$file" | # get file content tr '\n' ' ' | # remove line breaks sed -e 's/]*>//g' | # remove attributes from svg element base64 -w 0 | # encode svg sed "s|.*|\"$file\" |" - done | tr '\n' ' ' >> $GITHUB_OUTPUT + done <<< "$CHANGED_FILES" | tr '\n' ' ' >> $GITHUB_OUTPUT echo >> $GITHUB_OUTPUT echo "$delimiter" >> $GITHUB_OUTPUT - name: Generate cohesion check random @@ -82,7 +90,7 @@ jobs: sed -e 's/]*>//g' | # remove attributes from svg element base64 -w 0 | # encode svg sed "s|.*|\"$file\" |" - done | tr '\n' ' ' >> $GITHUB_OUTPUT + done <<< "$CHANGED_FILES" | tr '\n' ' ' >> $GITHUB_OUTPUT echo >> $GITHUB_OUTPUT echo "$delimiter" >> $GITHUB_OUTPUT - name: Generate cohesion check squares @@ -96,7 +104,7 @@ jobs: sed -e 's/]*>//g' | # remove attributes from svg element base64 -w 0 | # encode svg sed "s|.*|\"$file\" |" - done | tr '\n' ' ' >> $GITHUB_OUTPUT + done <<< "$CHANGED_FILES" | tr '\n' ' ' >> $GITHUB_OUTPUT echo >> $GITHUB_OUTPUT echo "$delimiter" >> $GITHUB_OUTPUT - name: Generate 1px stroke-width @@ -104,13 +112,13 @@ jobs: run: | delimiter="$(openssl rand -hex 8)" echo "body<<$delimiter" >> $GITHUB_OUTPUT - for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + while IFS= read -r file; do cat "$file" | # get file content tr '\n' ' ' | # remove line breaks sed -e 's/]*>//g' | # remove attributes from svg element base64 -w 0 | # encode svg sed "s|.*|\"$file\" |" - done | tr '\n' ' ' >> $GITHUB_OUTPUT + done <<< "$CHANGED_FILES" | tr '\n' ' ' >> $GITHUB_OUTPUT echo >> $GITHUB_OUTPUT echo "$delimiter" >> $GITHUB_OUTPUT - name: Generate 2px stroke-width @@ -118,13 +126,13 @@ jobs: run: | delimiter="$(openssl rand -hex 8)" echo "body<<$delimiter" >> $GITHUB_OUTPUT - for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + while IFS= read -r file; do cat "$file" | # get file content tr '\n' ' ' | # remove line breaks sed -e 's/]*>//g' | # remove attributes from svg element base64 -w 0 | # encode svg sed "s|.*|\"$file\" |" - done | tr '\n' ' ' >> $GITHUB_OUTPUT + done <<< "$CHANGED_FILES" | tr '\n' ' ' >> $GITHUB_OUTPUT echo >> $GITHUB_OUTPUT echo "$delimiter" >> $GITHUB_OUTPUT - name: Generate 3px stroke-width @@ -132,13 +140,13 @@ jobs: run: | delimiter="$(openssl rand -hex 8)" echo "body<<$delimiter" >> $GITHUB_OUTPUT - for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + while IFS= read -r file; do cat "$file" | # get file content tr '\n' ' ' | # remove line breaks sed -e 's/]*>//g' | # remove attributes from svg element base64 -w 0 | # encode svg sed "s|.*|\"$file\" |" - done | tr '\n' ' ' >> $GITHUB_OUTPUT + done <<< "$CHANGED_FILES" | tr '\n' ' ' >> $GITHUB_OUTPUT echo >> $GITHUB_OUTPUT echo "$delimiter" >> $GITHUB_OUTPUT - name: Generate X-rays @@ -146,13 +154,13 @@ jobs: run: | delimiter="$(openssl rand -hex 8)" echo "body<<$delimiter" >> $GITHUB_OUTPUT - for file in ${{ steps.changed-files.outputs.all_changed_files }}; do + while IFS= read -r file; do cat "$file" | # get file content tr '\n' ' ' | # remove line breaks sed -e 's/]*>//g' | # remove attributes from svg element base64 -w 0 | # encode svg sed "s|.*|\"$file\" |" - done | tr '\n' ' ' >> $GITHUB_OUTPUT + done <<< "$CHANGED_FILES" | tr '\n' ' ' >> $GITHUB_OUTPUT echo >> $GITHUB_OUTPUT echo "$delimiter" >> $GITHUB_OUTPUT - name: Find Comment