Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7abdbc94e9 | ||
|
|
4f76fe6a8e | ||
|
|
1d1f2dec19 | ||
|
|
01fb130d1e | ||
|
|
031c7ba276 | ||
|
|
304c203f25 | ||
|
|
2e02d49f78 | ||
|
|
677631125b | ||
|
|
675ab58887 | ||
|
|
21a9d525da | ||
|
|
5a860fa1ae | ||
|
|
1b6483d0e7 |
49
.github/workflows/codacy-analysis.yml
vendored
Normal file
49
.github/workflows/codacy-analysis.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
# This workflow checks out code, performs a Codacy security scan
|
||||||
|
# and integrates the results with the
|
||||||
|
# GitHub Advanced Security code scanning feature. For more information on
|
||||||
|
# the Codacy security scan action usage and parameters, see
|
||||||
|
# https://github.com/codacy/codacy-analysis-cli-action.
|
||||||
|
# For more information on Codacy Analysis CLI in general, see
|
||||||
|
# https://github.com/codacy/codacy-analysis-cli.
|
||||||
|
|
||||||
|
name: Codacy Security Scan
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ main ]
|
||||||
|
schedule:
|
||||||
|
- cron: '15 16 * * 2'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
codacy-security-scan:
|
||||||
|
name: Codacy Security Scan
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
# Checkout the repository to the GitHub Actions runner
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
|
||||||
|
- name: Run Codacy Analysis CLI
|
||||||
|
uses: codacy/codacy-analysis-cli-action@4.0.0
|
||||||
|
with:
|
||||||
|
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
|
||||||
|
# You can also omit the token and run the tools that support default configurations
|
||||||
|
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
|
||||||
|
verbose: true
|
||||||
|
output: results.sarif
|
||||||
|
format: sarif
|
||||||
|
# Adjust severity of non-security issues
|
||||||
|
gh-code-scanning-compat: true
|
||||||
|
# Force 0 exit code to allow SARIF file generation
|
||||||
|
# This will handover control about PR rejection to the GitHub side
|
||||||
|
max-allowed-issues: 2147483647
|
||||||
|
|
||||||
|
# Upload the SARIF file generated in the previous step
|
||||||
|
- name: Upload SARIF results file
|
||||||
|
uses: github/codeql-action/upload-sarif@v1
|
||||||
|
with:
|
||||||
|
sarif_file: results.sarif
|
||||||
22
HISTORY.md
22
HISTORY.md
@@ -1,5 +1,27 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [v8.9](https://github.com/tj-actions/changed-files/tree/v8.9) (2021-07-18)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v8.8...v8.9)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Updated README.md [\#139](https://github.com/tj-actions/changed-files/pull/139) ([jackton1](https://github.com/jackton1))
|
||||||
|
- Upgraded to v8.8 [\#138](https://github.com/tj-actions/changed-files/pull/138) ([jackton1](https://github.com/jackton1))
|
||||||
|
|
||||||
|
## [v8.8](https://github.com/tj-actions/changed-files/tree/v8.8) (2021-07-17)
|
||||||
|
|
||||||
|
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v8.7...v8.8)
|
||||||
|
|
||||||
|
**Implemented enhancements:**
|
||||||
|
|
||||||
|
- \[Feature\] Ability to run a workflow if and only if certain file/directory changes [\#124](https://github.com/tj-actions/changed-files/issues/124)
|
||||||
|
|
||||||
|
**Merged pull requests:**
|
||||||
|
|
||||||
|
- Added support for detecting non specific file changes. [\#137](https://github.com/tj-actions/changed-files/pull/137) ([jackton1](https://github.com/jackton1))
|
||||||
|
- Upgraded to v8.7 [\#136](https://github.com/tj-actions/changed-files/pull/136) ([jackton1](https://github.com/jackton1))
|
||||||
|
|
||||||
## [v8.7](https://github.com/tj-actions/changed-files/tree/v8.7) (2021-07-17)
|
## [v8.7](https://github.com/tj-actions/changed-files/tree/v8.7) (2021-07-17)
|
||||||
|
|
||||||
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v8.6...v8.7)
|
[Full Changelog](https://github.com/tj-actions/changed-files/compare/v8.6...v8.7)
|
||||||
|
|||||||
31
README.md
31
README.md
@@ -55,7 +55,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Get changed files
|
- name: Get changed files
|
||||||
id: changed-files
|
id: changed-files
|
||||||
uses: tj-actions/changed-files@v8.7
|
uses: tj-actions/changed-files@v8.9
|
||||||
|
|
||||||
- name: List all modified files
|
- name: List all modified files
|
||||||
run: |
|
run: |
|
||||||
@@ -79,10 +79,10 @@ jobs:
|
|||||||
|
|
||||||
| Output | type | example | description |
|
| Output | type | example | description |
|
||||||
|:--------------------:|:------------:|:----------------------------------:|:----------------------------------------:|
|
|:--------------------:|:------------:|:----------------------------------:|:----------------------------------------:|
|
||||||
| any_changed | `string` | `true` OR `false` | Returns `true` when any of the filenames provided using the `files` input has changed |
|
| any_changed | `string` | `true` OR `false` | Returns `true` when any <br /> of the filenames provided using <br /> the `files` input has changed (ACMR) |
|
||||||
| only_changed | `string` | `true` OR `false` | Returns `true` when only files provided using the `files` input have changed. |
|
| only_changed | `string` | `true` OR `false` | Returns `true` when only <br /> files provided using <br /> the `files` input have changed. |
|
||||||
| other_changed_files | `string` | `'new.txt path/to/file.png ...'` | Select all modified files <br/> not listed in the files input <br /> i.e. *a combination of all added, <br /> copied and modified files (ACM).* |
|
| other_changed_files | `string` | `'new.txt path/to/file.png ...'` | Select all modified files <br/> not listed in the files input <br /> i.e. *a combination of all added, <br /> copied and modified files (ACM).* |
|
||||||
| all_modified_files | `string` | `'new.txt path/to/file.png ...'` | Select all modified files <br /> i.e. *a combination of all added, <br />copied and modified files (ACM).* |
|
| all_modified_files | `string` | `'new.txt path/to/file.png ...'` | Select all modified files <br /> i.e. *a combination of all added, <br />copied, modified and renamed files (ACMR).* |
|
||||||
| all_changed_files | `string` | `'new.txt path/to/file.png ...'` | Select all paths (\*) <br /> i.e. *a combination of all options below.* |
|
| all_changed_files | `string` | `'new.txt path/to/file.png ...'` | Select all paths (\*) <br /> i.e. *a combination of all options below.* |
|
||||||
| added_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Added (A) |
|
| added_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Added (A) |
|
||||||
| copied_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Copied (C) |
|
| copied_files | `string` | `'new.txt path/to/file.png ...'` | Select only files that are Copied (C) |
|
||||||
@@ -113,11 +113,11 @@ jobs:
|
|||||||
|
|
||||||
- name: Get changed files using defaults
|
- name: Get changed files using defaults
|
||||||
id: changed-files
|
id: changed-files
|
||||||
uses: tj-actions/changed-files@v8.7
|
uses: tj-actions/changed-files@v8.9
|
||||||
|
|
||||||
- name: Get changed files using a comma separator
|
- name: Get changed files using a comma separator
|
||||||
id: changed-files-comma
|
id: changed-files-comma
|
||||||
uses: tj-actions/changed-files@v8.7
|
uses: tj-actions/changed-files@v8.9
|
||||||
with:
|
with:
|
||||||
separator: ","
|
separator: ","
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Get specific changed files
|
- name: Get specific changed files
|
||||||
id: changed-files-specific
|
id: changed-files-specific
|
||||||
uses: tj-actions/changed-files@v8.7
|
uses: tj-actions/changed-files@v8.9
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
my-file.txt
|
my-file.txt
|
||||||
@@ -154,17 +154,22 @@ jobs:
|
|||||||
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
if: steps.changed-files-specific.outputs.any_changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
echo "One or more files listed above has changed."
|
echo "One or more files listed above has changed."
|
||||||
|
|
||||||
|
- name: Run step if only the files listed above change
|
||||||
|
if: steps.changed-files-specific.outputs.only_changed == 'true'
|
||||||
|
run: |
|
||||||
|
echo "Only files listed above have changed."
|
||||||
|
|
||||||
- name: Use a source file or list of file(s) to populate to files input.
|
- name: Use a source file or list of file(s) to populate to files input.
|
||||||
id: changed-files-specific-source-file
|
id: changed-files-specific-source-file
|
||||||
uses: tj-actions/changed-files@v8.7
|
uses: tj-actions/changed-files@v8.9
|
||||||
with:
|
with:
|
||||||
files_from_source_file: |
|
files_from_source_file: |
|
||||||
test/changed-files-list.txt
|
test/changed-files-list.txt
|
||||||
|
|
||||||
- name: Use a source file or list of file(s) to populate to files input and optionally specify more files.
|
- name: Use a source file or list of file(s) to populate to files input and optionally specify more files.
|
||||||
id: changed-files-specific-source-file-and-specify-files
|
id: changed-files-specific-source-file-and-specify-files
|
||||||
uses: tj-actions/changed-files@v8.7
|
uses: tj-actions/changed-files@v8.9
|
||||||
with:
|
with:
|
||||||
files_from_source_file: |
|
files_from_source_file: |
|
||||||
test/changed-files-list.txt
|
test/changed-files-list.txt
|
||||||
@@ -173,13 +178,13 @@ jobs:
|
|||||||
|
|
||||||
- name: Use a different commit SHA
|
- name: Use a different commit SHA
|
||||||
id: changed-files-custom-sha
|
id: changed-files-custom-sha
|
||||||
uses: tj-actions/changed-files@v8.7
|
uses: tj-actions/changed-files@v8.9
|
||||||
with:
|
with:
|
||||||
sha: ${{ github.event.pull_request.head.sha }}
|
sha: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
- name: Use a different base SHA
|
- name: Use a different base SHA
|
||||||
id: changed-files-custom-base-sha
|
id: changed-files-custom-base-sha
|
||||||
uses: tj-actions/changed-files@v8.7
|
uses: tj-actions/changed-files@v8.9
|
||||||
with:
|
with:
|
||||||
base_sha: "2096ed0"
|
base_sha: "2096ed0"
|
||||||
|
|
||||||
@@ -196,7 +201,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Get changed files
|
- name: Get changed files
|
||||||
id: changed-files
|
id: changed-files
|
||||||
uses: tj-actions/changed-files@v8.7
|
uses: tj-actions/changed-files@v8.9
|
||||||
|
|
||||||
- name: Pre-commit
|
- name: Pre-commit
|
||||||
uses: pre-commit/action@v2.0.0
|
uses: pre-commit/action@v2.0.0
|
||||||
@@ -205,8 +210,6 @@ jobs:
|
|||||||
token: ${{ secrets.github_token }}
|
token: ${{ secrets.github_token }}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example
|
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
name: Changed files
|
name: Changed files
|
||||||
description: Get all changed files
|
description: Get all changed files for push and pull request events.
|
||||||
author: tj-actions
|
author: tj-actions
|
||||||
inputs:
|
inputs:
|
||||||
token:
|
token:
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ if [[ -z "$UNIQUE_FILES" ]]; then
|
|||||||
UNMERGED=$(git diff --diff-filter=U --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
UNMERGED=$(git diff --diff-filter=U --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
||||||
UNKNOWN=$(git diff --diff-filter=X --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
UNKNOWN=$(git diff --diff-filter=X --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
||||||
ALL_CHANGED=$(git diff --diff-filter="*ACDMRTUX" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
ALL_CHANGED=$(git diff --diff-filter="*ACDMRTUX" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
||||||
ALL_MODIFIED_FILES=$(git diff --diff-filter="ACM" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
ALL_MODIFIED_FILES=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | tr "\n" "$INPUT_SEPARATOR" | sed -E "s/($INPUT_SEPARATOR)$//")
|
||||||
else
|
else
|
||||||
ADDED_ARRAY=()
|
ADDED_ARRAY=()
|
||||||
COPIED_ARRAY=()
|
COPIED_ARRAY=()
|
||||||
@@ -100,7 +100,7 @@ else
|
|||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
ALL_CHANGED_ARRAY+=($(git diff --diff-filter="*ACDMRTUX" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs || true))
|
ALL_CHANGED_ARRAY+=($(git diff --diff-filter="*ACDMRTUX" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs || true))
|
||||||
# shellcheck disable=SC2207
|
# shellcheck disable=SC2207
|
||||||
ALL_MODIFIED_FILES_ARRAY+=($(git diff --diff-filter="ACM" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs || true))
|
ALL_MODIFIED_FILES_ARRAY+=($(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA" | grep -E "(${path})" | xargs || true))
|
||||||
done
|
done
|
||||||
|
|
||||||
# shellcheck disable=SC2001
|
# shellcheck disable=SC2001
|
||||||
@@ -139,7 +139,7 @@ echo "All modified files: $ALL_MODIFIED_FILES"
|
|||||||
if [[ -n "$UNIQUE_FILES" ]]; then
|
if [[ -n "$UNIQUE_FILES" ]]; then
|
||||||
# shellcheck disable=SC2001
|
# shellcheck disable=SC2001
|
||||||
ALL_INPUT_FILES=$(echo "$UNIQUE_FILES" | tr "\n" " " | xargs)
|
ALL_INPUT_FILES=$(echo "$UNIQUE_FILES" | tr "\n" " " | xargs)
|
||||||
ALL_OTHER_CHANGED_FILES=$(git diff --diff-filter="ACM" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA")
|
ALL_OTHER_CHANGED_FILES=$(git diff --diff-filter="ACMR" --name-only "$PREVIOUS_SHA" "$CURRENT_SHA")
|
||||||
|
|
||||||
OTHER_CHANGED_FILES=$(echo "${ALL_OTHER_CHANGED_FILES[@]}" "${ALL_MODIFIED_FILES[@]}" | tr ' ' '\n' | sort | uniq -u | tr "\n" " " | xargs)
|
OTHER_CHANGED_FILES=$(echo "${ALL_OTHER_CHANGED_FILES[@]}" "${ALL_MODIFIED_FILES[@]}" | tr ' ' '\n' | sort | uniq -u | tr "\n" " " | xargs)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user