mirror of
https://github.com/tj-actions/changed-files
synced 2025-01-17 09:17:46 +00:00
feat: add support for json formatted output. (#557)
This commit is contained in:
parent
3020c439b0
commit
fb62fbd197
5 changed files with 141 additions and 36 deletions
39
.github/workflows/manual-matrix-test.yml
vendored
Normal file
39
.github/workflows/manual-matrix-test.yml
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
name: Manual Matrix Test
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
changed-files:
|
||||
name: Get changes
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: "{\"container\": ${{ toJson(steps.changed-files.outputs.all_changed_files) }} }"
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0 # needed for tj-actions/changed-files
|
||||
- name: Get changed files
|
||||
id: changed-files
|
||||
uses: tj-actions/changed-files@v23
|
||||
with:
|
||||
json: true
|
||||
- name: List all changed files
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files.outputs.all_changed_files) }}'
|
||||
|
||||
matrix-job:
|
||||
name: Run Matrix Job
|
||||
runs-on: ubuntu-latest
|
||||
needs: [changed-files]
|
||||
strategy:
|
||||
matrix: ${{ fromJSON(needs.changed-files.outputs.matrix) }}
|
||||
max-parallel: 4
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Test
|
||||
run: |
|
||||
echo ${{ matrix.container }}
|
11
.github/workflows/test.yml
vendored
11
.github/workflows/test.yml
vendored
|
@ -332,6 +332,17 @@ jobs:
|
|||
echo '${{ toJSON(steps.changed-files-pipe.outputs) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with json output
|
||||
id: changed-files-json
|
||||
uses: ./
|
||||
with:
|
||||
json: true
|
||||
- name: Show output
|
||||
run: |
|
||||
echo '${{ toJSON(steps.changed-files-json.outputs) }}'
|
||||
echo '${{ toJSON(steps.changed-files-json.outputs.all_changed_files) }}'
|
||||
shell:
|
||||
bash
|
||||
- name: Run changed-files with comma separator
|
||||
id: changed-files-comma
|
||||
uses: ./
|
||||
|
|
12
README.md
12
README.md
|
@ -130,7 +130,7 @@ Support this project with a :star:
|
|||
|:--------------------------------------:|:----------------------:|:--------:|:---------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
|
||||
| token | `string` | `false` | `${{ github.token }}` | [GITHUB\_TOKEN](https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#using-the-github_token-in-a-workflow) <br /> or a repo scoped <br /> [Personal Access Token](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token) |
|
||||
| separator | `string` | `false` | `' '` | Split character for output strings |
|
||||
| include\_all\_old\_new\_renamed\_files | `boolean` | `false` | `false` | Include `all_old_new_renamed_files` output. Note this can generate a large output See: [#501](https://github.com/tj-actions/changed-files/issues/501). |
|
||||
| include\_all\_old\_new\_renamed\_files | `boolean` | `false` | `false` | Include `all_old_new_renamed_files` output. Note this can generate a large output See: [#501](https://github.com/tj-actions/changed-files/issues/501). |
|
||||
| old\_new\_separator | `string` | `false` | `','` | Split character for old and new filename pairs |
|
||||
| old\_new\_files\_separator | `string` | `false` | `' '` | Split character for multiple old and new filename pairs |
|
||||
| files | `string` OR `string[]` | `false` | | Check for changes <br> using only these <br> list of file(s) <br> (Defaults to the <br> entire repo) |
|
||||
|
@ -146,7 +146,8 @@ Support this project with a :star:
|
|||
| use\_fork\_point | `boolean` | `false` | `false` | Finds best common ancestor <br /> between two commits <br /> to use in a three-way merge <br /> as the `base_sha` <br /> See: [git merge-base](https://git-scm.com/docs/git-merge-base#Documentation/git-merge-base.txt---fork-point). <br> NOTE: This pulls the entire commit history of the base branch |
|
||||
| quotepath | `boolean` | `false` | `true` | Output filenames completely verbatim by setting this to `false` |
|
||||
| diff\_relative | `boolean` | `false` | | Exclude changes outside the current directory and show pathnames relative to it. |
|
||||
| dir\_names | `boolean` | `false` | `false` | Output unique changed directories instead of filenames. <br> NOTE: This returns `.` for <br> changed files located in the root of the project. |
|
||||
| dir\_names | `boolean` | `false` | `false` | Output unique changed directories instead of filenames. <br> NOTE: This returns `.` for <br> changed files located in the root of the project. |
|
||||
| json | `boolean` | `false` | `false` | Output changed files in JSON format which can be used for matrix jobs. |
|
||||
|
||||
## Examples
|
||||
|
||||
|
@ -337,6 +338,13 @@ Support this project with a :star:
|
|||
uses: tj-actions/changed-files@v24
|
||||
with:
|
||||
dir_names: "true"
|
||||
|
||||
# All outputs are JSON formatted arrays and can be used in other actions and matrix compatible jobs.
|
||||
- name: Run changed-files with json output
|
||||
id: changed-files-json
|
||||
uses: tj-actions/changed-files@v24
|
||||
with:
|
||||
json: "true"
|
||||
```
|
||||
|
||||
<img width="1147" alt="Screen Shot 2021-11-19 at 4 59 21 PM" src="https://user-images.githubusercontent.com/17484350/142696936-8b7ca955-7ef9-4d53-9bdf-3e0008e90c3f.png">
|
||||
|
|
|
@ -77,6 +77,10 @@ inputs:
|
|||
default: "false"
|
||||
description: "Output the absolute path to the changed directories instead of the filenames"
|
||||
required: false
|
||||
json:
|
||||
description: "Output changed files in JSON format which can be used for matrix jobs"
|
||||
required: false
|
||||
default: "false"
|
||||
|
||||
outputs:
|
||||
added_files:
|
||||
|
@ -212,6 +216,7 @@ runs:
|
|||
INPUT_OLD_NEW_FILES_SEPARATOR: ${{ inputs.old_new_files_separator }}
|
||||
INPUT_DIFF_RELATIVE: ${{ inputs.diff_relative }}
|
||||
INPUT_DIR_NAMES: ${{ inputs.dir_names }}
|
||||
INPUT_JSON: ${{ inputs.json }}
|
||||
|
||||
branding:
|
||||
icon: file-text
|
||||
|
|
110
entrypoint.sh
110
entrypoint.sh
|
@ -69,7 +69,7 @@ echo "::group::changed-files"
|
|||
if [[ -n $INPUT_PATH ]]; then
|
||||
REPO_DIR="$GITHUB_WORKSPACE/$INPUT_PATH"
|
||||
|
||||
echo "::debug::Resolving repository path: $REPO_DIR"
|
||||
echo "Resolving repository path: $REPO_DIR"
|
||||
if [[ ! -d "$REPO_DIR" ]]; then
|
||||
echo "::error::Invalid repository path: $REPO_DIR"
|
||||
exit 1
|
||||
|
@ -77,24 +77,41 @@ if [[ -n $INPUT_PATH ]]; then
|
|||
cd "$REPO_DIR"
|
||||
fi
|
||||
|
||||
echo "::debug::Retrieving changes between $INPUT_PREVIOUS_SHA ($INPUT_TARGET_BRANCH) → $INPUT_CURRENT_SHA ($INPUT_CURRENT_BRANCH)"
|
||||
echo "Retrieving changes between $INPUT_PREVIOUS_SHA ($INPUT_TARGET_BRANCH) → $INPUT_CURRENT_SHA ($INPUT_CURRENT_BRANCH)"
|
||||
|
||||
echo "::debug::Getting diff..."
|
||||
echo "Getting diff..."
|
||||
|
||||
if [[ -z "$INPUT_FILES_PATTERN_FILE" ]]; then
|
||||
ADDED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" A | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
COPIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" C | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
DELETED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" D | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" M | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
RENAMED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" R | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
TYPE_CHANGED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" T | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
UNMERGED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" U | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
UNKNOWN=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" X | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
ALL_CHANGED_AND_MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "*ACDMRTUX" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
ALL_CHANGED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "ACMR" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
ALL_MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "ACMRD" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
if [[ $INPUT_INCLUDE_ALL_OLD_NEW_RENAMED_FILES == "true" ]]; then
|
||||
ALL_OLD_NEW_RENAMED=$(get_renames "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" | awk -v d="$INPUT_OLD_NEW_FILES_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
if [[ "$INPUT_JSON" == "false" ]]; then
|
||||
ADDED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" A | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
COPIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" C | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
DELETED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" D | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" M | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
RENAMED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" R | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
TYPE_CHANGED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" T | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
UNMERGED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" U | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
UNKNOWN=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" X | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
ALL_CHANGED_AND_MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "*ACDMRTUX" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
ALL_CHANGED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "ACMR" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
ALL_MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "ACMRD" | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
if [[ $INPUT_INCLUDE_ALL_OLD_NEW_RENAMED_FILES == "true" ]]; then
|
||||
ALL_OLD_NEW_RENAMED=$(get_renames "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" | awk -v d="$INPUT_OLD_NEW_FILES_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
fi
|
||||
else
|
||||
ADDED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" A | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}'| jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
COPIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" C | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}'| jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
DELETED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" D | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}'| jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" M | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}'| jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
RENAMED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" R | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}'| jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
TYPE_CHANGED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" T | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}'| jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
UNMERGED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" U | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}'| jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
UNKNOWN=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" X | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}'| jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
ALL_CHANGED_AND_MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "*ACDMRTUX" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}'| jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
ALL_CHANGED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "ACMR" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}'| jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
ALL_MODIFIED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" "ACMRD" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}'| jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
if [[ $INPUT_INCLUDE_ALL_OLD_NEW_RENAMED_FILES == "true" ]]; then
|
||||
ALL_OLD_NEW_RENAMED=$(get_renames "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}'| jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
fi
|
||||
fi
|
||||
else
|
||||
ADDED=$(get_diff "$INPUT_PREVIOUS_SHA" "$INPUT_CURRENT_SHA" A | grep -x -E -f "$INPUT_FILES_PATTERN_FILE" | awk -v d="|" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
|
@ -131,9 +148,13 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
OTHER_CHANGED=$(echo "${OTHER_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
if [[ "$INPUT_JSON" == "false" ]]; then
|
||||
OTHER_CHANGED=$(echo "${OTHER_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
else
|
||||
OTHER_CHANGED=$(echo "${OTHER_CHANGED}" | jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
fi
|
||||
|
||||
if [[ -n "${OTHER_CHANGED}" ]]; then
|
||||
if [[ -n "${OTHER_CHANGED}" && "${OTHER_CHANGED}" != "[]" ]]; then
|
||||
echo "::debug::Non Matching changed files: ${OTHER_CHANGED}"
|
||||
echo "::set-output name=only_changed::false"
|
||||
echo "::set-output name=other_changed_files::$OTHER_CHANGED"
|
||||
|
@ -160,9 +181,13 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
OTHER_MODIFIED=$(echo "${OTHER_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
if [[ "$INPUT_JSON" == "false" ]]; then
|
||||
OTHER_MODIFIED=$(echo "${OTHER_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
else
|
||||
OTHER_MODIFIED=$(echo "${OTHER_MODIFIED}" | jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
fi
|
||||
|
||||
if [[ -n "${OTHER_MODIFIED}" ]]; then
|
||||
if [[ -n "${OTHER_MODIFIED}" && "$OTHER_MODIFIED" != "[]" ]]; then
|
||||
echo "::debug::Non Matching modified files: ${OTHER_MODIFIED}"
|
||||
echo "::set-output name=only_modified::false"
|
||||
echo "::set-output name=other_modified_files::$OTHER_MODIFIED"
|
||||
|
@ -189,27 +214,44 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
OTHER_DELETED=$(echo "${OTHER_DELETED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
if [[ "$INPUT_JSON" == "false" ]]; then
|
||||
OTHER_DELETED=$(echo "${OTHER_DELETED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
else
|
||||
OTHER_DELETED=$(echo "${OTHER_DELETED}" | jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
fi
|
||||
|
||||
if [[ -n "${OTHER_DELETED}" ]]; then
|
||||
if [[ -n "${OTHER_DELETED}" && "${OTHER_DELETED}" != "[]" ]]; then
|
||||
echo "::debug::Non Matching deleted files: ${OTHER_DELETED}"
|
||||
echo "::set-output name=only_deleted::false"
|
||||
echo "::set-output name=other_deleted_files::$OTHER_DELETED"
|
||||
elif [[ -n "${DELETED}" ]]; then
|
||||
echo "::set-output name=only_deleted::true"
|
||||
fi
|
||||
|
||||
ADDED=$(echo "${ADDED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
COPIED=$(echo "${COPIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
DELETED=$(echo "${DELETED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
MODIFIED=$(echo "${MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
RENAMED=$(echo "${RENAMED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
TYPE_CHANGED=$(echo "${TYPE_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
UNMERGED=$(echo "${UNMERGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
UNKNOWN=$(echo "${UNKNOWN}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
ALL_CHANGED_AND_MODIFIED=$(echo "${ALL_CHANGED_AND_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
ALL_CHANGED=$(echo "${ALL_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
ALL_MODIFIED=$(echo "${ALL_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
if [[ "$INPUT_JSON" == "false" ]]; then
|
||||
ADDED=$(echo "${ADDED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
COPIED=$(echo "${COPIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
DELETED=$(echo "${DELETED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
MODIFIED=$(echo "${MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
RENAMED=$(echo "${RENAMED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
TYPE_CHANGED=$(echo "${TYPE_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
UNMERGED=$(echo "${UNMERGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
UNKNOWN=$(echo "${UNKNOWN}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
ALL_CHANGED_AND_MODIFIED=$(echo "${ALL_CHANGED_AND_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
ALL_CHANGED=$(echo "${ALL_CHANGED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
ALL_MODIFIED=$(echo "${ALL_MODIFIED}" | awk '{gsub(/\|/,"\n"); print $0;}' | awk -v d="$INPUT_SEPARATOR" '{s=(NR==1?s:s d)$0}END{print s}')
|
||||
else
|
||||
ADDED=$(echo "${ADDED}" | jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
COPIED=$(echo "${COPIED}" | jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
DELETED=$(echo "${DELETED}" | jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
MODIFIED=$(echo "${MODIFIED}" | jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
RENAMED=$(echo "${RENAMED}" | jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
TYPE_CHANGED=$(echo "${TYPE_CHANGED}" | jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
UNMERGED=$(echo "${UNMERGED}" | jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
UNKNOWN=$(echo "${UNKNOWN}" | jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
ALL_CHANGED_AND_MODIFIED=$(echo "${ALL_CHANGED_AND_MODIFIED}" | jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
ALL_CHANGED=$(echo "${ALL_CHANGED}" | jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
ALL_MODIFIED=$(echo "${ALL_MODIFIED}" | jq -R 'split("|") | @json' | sed -r 's/^"|"$//g' | tr -s /)
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "::debug::Added files: $ADDED"
|
||||
|
|
Loading…
Reference in a new issue