Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/it-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
name: "IT Test - default inputs values should work fine on this repo"
runs-on: github-ubuntu-latest-s
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Given the gh-action is used with default values
id: test-data
uses: ./
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2
- uses: nick-fields/assert-action@aa0067e01f0f6545c31755d6ca128c5a3a14f6bf # v2.0.0
name: Then outputs.status value must be 0 as the project itself makes use of pre-commit validation
with:
expected: 0
Expand All @@ -24,7 +24,7 @@ jobs:
name: "IT Test - custom extra-args should be honored"
runs-on: github-ubuntu-latest-s
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Given the gh-action is used with extra-args=--help
id: test-data
uses: ./
Expand All @@ -41,7 +41,7 @@ jobs:
name: "IT Test - output status should be 1 given pre-commit detected some issue"
runs-on: github-ubuntu-latest-s
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Given a pre-commit-config not correctly respected
id: test-data
uses: ./
Expand All @@ -60,7 +60,7 @@ jobs:
name: "IT Test - output status should be 0 given pre-commit detected no issue"
runs-on: github-ubuntu-latest-s
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Given a pre-commit-config correctly respected
id: test-data
uses: ./
Expand All @@ -79,7 +79,7 @@ jobs:
name: "IT Test - output logs should contain failures given pre-commit detected some issue"
runs-on: github-ubuntu-latest-s
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Given a pre-commit-config not correctly respected
id: test-data
uses: ./
Expand All @@ -98,7 +98,7 @@ jobs:
name: "IT Test - output logs should contain no failure given pre-commit detected no issue"
runs-on: github-ubuntu-latest-s
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Given a pre-commit-config correctly respected
id: test-data
uses: ./
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
name: "pre-commit"
runs-on: github-ubuntu-latest-s
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- uses: ./
with:
extra-args: >
Expand Down
8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,27 @@
- name: Validate inputs and export
shell: bash
run: |
CONFIG_PATH="${{ inputs.config-path }}"

Check failure on line 30 in action.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

inputs.config-path is vulnerable to script injection: values of inputs are provided by whoever triggers the workflow. Change this action to not use user-controlled data directly in a run block, for example by assigning this expression to an environment variable.

See more on https://sonarcloud.io/project/issues?id=SonarSource_gh-action_pre-commit&issues=AZ6J9-wTQZcijfkatwIB&open=AZ6J9-wTQZcijfkatwIB&pullRequest=45
EXTRA_ARGS="${{ inputs.extra-args }}"

Check failure on line 31 in action.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

inputs.extra-args is vulnerable to script injection: values of inputs are provided by whoever triggers the workflow. Change this action to not use user-controlled data directly in a run block, for example by assigning this expression to an environment variable.

See more on https://sonarcloud.io/project/issues?id=SonarSource_gh-action_pre-commit&issues=AZ6J9-wTQZcijfkatwIC&open=AZ6J9-wTQZcijfkatwIC&pullRequest=45
echo "CONFIG_PATH=$CONFIG_PATH" >> "$GITHUB_ENV"
echo "EXTRA_ARGS=$EXTRA_ARGS" >> "$GITHUB_ENV"
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
- name: Fetch origin
run: git fetch origin # avoid unknown revision or path not in the working tree when
# using --from-ref --to-ref feature of pre-commit
shell: bash
- id: setup_python
name: Setup python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548 # v6.1.0
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
Comment thread
matemoln marked this conversation as resolved.
with:
python-version: '3.14'
- name: Setup pre-commit
run: |
python -m pip install --upgrade pip
python -m pip install --quiet pre-commit==3.7.1
shell: bash
- uses: actions/cache/restore@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
- uses: actions/cache/restore@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
Comment thread
matemoln marked this conversation as resolved.
id: restore-cache
with:
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles(env.CONFIG_PATH) }}
Expand All @@ -65,7 +65,7 @@
run: |
pre-commit install-hooks --config="$CONFIG_PATH"
shell: bash
- uses: actions/cache/save@9255dc7a253b0ccc959486e2bca901246202afeb # v5.0.1
- uses: actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
if: steps.restore-cache.outputs.cache-hit != 'true' &&
github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
with:
Expand Down
Loading