Skip to content

Commit 01db727

Browse files
hamishwilleePX4BuildBot
andauthored
Fix workflow vulnerabilities in flaw checker and comments (#25419)
* docs_pr_comment.yml - fix script expansion issue * Fix flaw checker too * docs_flaw_checker.yml - tj-actions/changed files to latest Fixes security bug in using vulnerable version --------- Co-authored-by: PX4BuildBot <bot@pixhawk.org>
1 parent f3e7d14 commit 01db727

File tree

2 files changed

+24
-10
lines changed

2 files changed

+24
-10
lines changed

.github/workflows/docs_flaw_checker.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
3030
- name: Get changed english doc files
3131
id: get_changed_markdown_english
32-
uses: tj-actions/changed-files@v35.9.2
32+
uses: tj-actions/changed-files@v46.0.5
3333
with:
3434
json: true
3535
base_sha: "${{ github.event.pull_request.base.sha }}"
@@ -42,14 +42,23 @@ jobs:
4242
4343
- name: Save JSON file containing files to link check
4444
run: |
45-
echo "${{ steps.get_changed_markdown_english.outputs.all_changed_files }}"
46-
echo "${{ steps.get_changed_markdown_english.outputs.all_changed_files }}" > ./logs/prFiles.json
45+
echo "$ALL_CHANGED_FILES"
46+
echo "$ALL_CHANGED_FILES" > ./logs/prFiles.json
47+
env:
48+
ALL_CHANGED_FILES: ${{ steps.get_changed_markdown_english.outputs.all_changed_files }}
4749

4850
- name: Run link checker
4951
id: link-check
5052
run: |
5153
npm -g install markdown_link_checker_sc@0.0.138
52-
markdown_link_checker_sc -r ${{ github.workspace }} -d docs -e en -f ./logs/prFiles.json -i assets -u docs.px4.io/main/ > ./logs/errorsFilteredByPrPages.md
54+
markdown_link_checker_sc \
55+
-r "$GITHUB_WORKSPACE" \
56+
-d docs \
57+
-e en \
58+
-f ./logs/prFiles.json \
59+
-i assets \
60+
-u docs.px4.io/main/ \
61+
> ./logs/errorsFilteredByPrPages.md
5362
mkdir -p ./pr
5463
cp ./logs/errorsFilteredByPrPages.md ./pr/errorsFilteredByPrPages.md
5564
@@ -60,14 +69,15 @@ jobs:
6069
path: ./logs/errorsFilteredByPrPages.md
6170

6271
- name: Echo Errors by Page
63-
run: echo "${{ steps.read-errors-by-page.outputs.content }}"
72+
run: echo "$ERRORS"
73+
env:
74+
ERRORS: ${{ steps.read-errors-by-page.outputs.content }}
6475

6576
- name: Save PR number
77+
run: echo "$PR_NUMBER" > ./pr/pr_number
6678
env:
6779
PR_NUMBER: ${{ github.event.number }}
68-
run: |
69-
#mkdir -p ./pr
70-
echo $PR_NUMBER > ./pr/pr_number
80+
7181
- uses: actions/upload-artifact@v4
7282
with:
7383
name: pr_number

.github/workflows/docs_pr_comment.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
workflows: ["Docs - Check for flaws in PX4 Guide Source"]
55
types:
66
- completed
7+
78
jobs:
89
comment:
910
permissions:
@@ -56,8 +57,11 @@ jobs:
5657

5758
- name: File detail info
5859
run: |
59-
echo "${{ steps.read-errors-by-page.outputs.content }}"
60-
echo "${{ steps.read-error-pr-number.outputs.content }}"
60+
echo "$ERRORS"
61+
echo "$PRNUM"
62+
env:
63+
ERRORS: ${{ steps.read-errors-by-page.outputs.content }}
64+
PRNUM: ${{ steps.read-error-pr-number.outputs.content }}
6165

6266
- name: Create or update comment
6367
id: comment_to_pr

0 commit comments

Comments
 (0)