1919 steps :
2020 - name : Comment
2121 id : create-comment
22- uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 .0.1
22+ uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 .0.0
2323 with :
2424 script : |
2525 const result = await github.rest.issues.createComment({
@@ -32,11 +32,20 @@ jobs:
3232
3333 - name : Get Component name
3434 id : get_component
35- run : |-
36- comment="${{ github.event.comment.body }}"
37- component=$(echo $comment | sed -n 's/^@esphomebot generate image //p')
38- echo "name=$component" >> $GITHUB_OUTPUT
39- echo "name_lower=${component,,}" >> $GITHUB_OUTPUT
35+ env :
36+ COMMENT_BODY : ${{ github.event.comment.body }}
37+ run : |
38+ # Extract component name using bash parameter expansion (no external commands)
39+ component="${COMMENT_BODY#@esphomebot generate image }"
40+
41+ # Validate component name: only lowercase alphanumeric and underscores
42+ if [[ "$component" =~ ^[a-z0-9_]+$ ]]; then
43+ echo "name=$component" >> $GITHUB_OUTPUT
44+ echo "name_lower=${component,,}" >> $GITHUB_OUTPUT
45+ else
46+ echo "::error::Invalid component name. Must contain only lowercase letters, numbers, and underscores."
47+ exit 1
48+ fi
4049
4150 generate :
4251 name : Generate
@@ -50,14 +59,14 @@ jobs:
5059 component : ${{ needs.prepare.outputs.name }}
5160
5261 - name : Upload
53- uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
62+ uses : actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
5463 id : upload-artifact
5564 with :
5665 name : ${{ needs.prepare.outputs.name }}
5766 path : ${{ needs.prepare.outputs.name_lower }}.svg
5867
5968 - name : Update Comment
60- uses : actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 .0.1
69+ uses : actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 .0.0
6170 with :
6271 script : |
6372 await github.rest.issues.updateComment({
0 commit comments