mirror of
https://github.com/bitnami/charts.git
synced 2026-03-11 07:17:45 +08:00
[bitnami/charts] GitHub actions hardening (#20675)
* GitHub actions hardening Signed-off-by: Fran Mulero <fmulero@vmware.com> * Fix typo Signed-off-by: Fran Mulero <fmulero@vmware.com> --------- Signed-off-by: Fran Mulero <fmulero@vmware.com>
This commit is contained in:
9
.github/workflows/markdown-linter.yml
vendored
9
.github/workflows/markdown-linter.yml
vendored
@@ -19,20 +19,21 @@ jobs:
|
||||
- name: Install mardownlint
|
||||
run: npm install -g markdownlint-cli@0.33.0
|
||||
- name: Checkout project
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
||||
- name: Execute markdownlint
|
||||
env:
|
||||
DIFF_URL: "${{github.event.pull_request.diff_url}}"
|
||||
TEMP_FILE: "${{runner.temp}}/pr-${{github.event.number}}.diff"
|
||||
TEMP_OUTPUT: "${{runner.temp}}/output"
|
||||
run: |
|
||||
# This request doesn't consume API calls.
|
||||
curl -Lkso $TEMP_FILE $DIFF_URL
|
||||
files_changed="$(sed -nr 's/[\-\+]{3} [ab]\/(.*)/\1/p' $TEMP_FILE | sort | uniq)"
|
||||
md_files="$(echo "$files_changed" | grep -o ".*\.md$" | sort | uniq || true)"
|
||||
# Create an empty file, useful when the PR changes ignored files
|
||||
touch ${{runner.temp}}/output
|
||||
touch "${TEMP_OUTPUT}"
|
||||
exit_code=0
|
||||
markdownlint -o ${{runner.temp}}/output ${md_files[@]} || exit_code=$?
|
||||
markdownlint -o "${TEMP_OUTPUT}" ${md_files[@]} || exit_code=$?
|
||||
while read -r line; do
|
||||
# line format:
|
||||
# file:row[:column] message
|
||||
@@ -48,7 +49,7 @@ jobs:
|
||||
else
|
||||
echo "::warning:: Error processing: ${line}"
|
||||
fi
|
||||
done < ${{runner.temp}}/output
|
||||
done < "${TEMP_OUTPUT}"
|
||||
if [[ $exit_code -ne 0 ]]; then
|
||||
echo "::error:: Please review linter messages"
|
||||
exit "$exit_code"
|
||||
|
||||
Reference in New Issue
Block a user