diff --git a/.github/actions/integration/files_deleted.csv b/.github/actions/integration/files_removed.csv similarity index 100% rename from .github/actions/integration/files_deleted.csv rename to .github/actions/integration/files_removed.csv diff --git a/.github/actions/integration/files_deleted.json b/.github/actions/integration/files_removed.json similarity index 100% rename from .github/actions/integration/files_deleted.json rename to .github/actions/integration/files_removed.json diff --git a/.github/actions/integration/files_deleted.txt b/.github/actions/integration/files_removed.txt similarity index 100% rename from .github/actions/integration/files_deleted.txt rename to .github/actions/integration/files_removed.txt diff --git a/.github/actions/integration/test.sh b/.github/actions/integration/test.sh index 0968d79d..e037630b 100755 --- a/.github/actions/integration/test.sh +++ b/.github/actions/integration/test.sh @@ -72,7 +72,7 @@ testResults () { result=51 elif [ "$4" == 'files_modified' ]; then result=12 - elif [ "$4" == 'files_deleted' ]; then + elif [ "$4" == 'files_removed' ]; then result=7 fi if [ "$2" == 'json' ]; then @@ -107,15 +107,15 @@ runTest () { test () { if [ "$output" == "" ] || [ "$fileOutput" == "" ]; then - for format in "json" "," " "; do \ + for format in "json" "," "\' \'"; do \ echo '\033[1;92mFORMAT:"'$format'"\033[0m' - for file in "files" "files_modified" "files_added" "files_deleted"; do \ + for file in "files" "files_modified" "files_added" "files_removed"; do \ echo '\033[1;92mFILE:'$file'\033[0m' runTest $file "$format" "$format" done done else - for file in "files" "files_modified" "files_added" "files_deleted"; do \ + for file in "files" "files_modified" "files_added" "files_removed"; do \ echo '\033[1;92mFILE:'$file'\033[0m' runTest $file "$fileOutput" "$output" done diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index ed495fae..b0dd96d6 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -101,7 +101,7 @@ jobs: files: ${{ format('{0}{1}', toJSON(steps.file_changes_build_pr.outputs.files), toJSON(steps.file_changes_build_push.outputs.files)) }} files_modified: ${{ format('{0}{1}', toJSON(steps.file_changes_build_pr.outputs.files_modified), toJSON(steps.file_changes_build_push.outputs.files_modified)) }} files_added: ${{ format('{0}{1}', toJSON(steps.file_changes_build_pr.outputs.files_added), toJSON(steps.file_changes_build_push.outputs.files_added)) }} - files_deleted: ${{ format('{0}{1}', toJSON(steps.file_changes_build_pr.outputs.files_deleted), toJSON(steps.file_changes_build_push.outputs.files_deleted)) }} + files_removed: ${{ format('{0}{1}', toJSON(steps.file_changes_build_pr.outputs.files_removed), toJSON(steps.file_changes_build_push.outputs.files_removed)) }} - run: chmod +x test.sh && ./test.sh working-directory: .github/actions/integration if: success() && matrix.output != 'json' @@ -111,4 +111,4 @@ jobs: files: ${{ format('{0}{1}', steps.file_changes_build_pr.outputs.files, steps.file_changes_build_push.outputs.files ) }} files_modified: ${{ format('{0}{1}', steps.file_changes_build_pr.outputs.files_modified, steps.file_changes_build_push.outputs.files_modified ) }} files_added: ${{ format('{0}{1}', steps.file_changes_build_pr.outputs.files_added, steps.file_changes_build_push.outputs.files_added ) }} - files_deleted: ${{ format('{0}{1}', steps.file_changes_build_pr.outputs.files_deleted, steps.file_changes_build_push.outputs.files_deleted ) }} \ No newline at end of file + files_removed: ${{ format('{0}{1}', steps.file_changes_build_pr.outputs.files_removed, steps.file_changes_build_push.outputs.files_removed ) }} \ No newline at end of file diff --git a/README.md b/README.md index c6591a2a..91edfdeb 100644 --- a/README.md +++ b/README.md @@ -44,7 +44,7 @@ _Optional_ - `string` - pass in a specific PR number to get file changes from. ### files -steps.file_changes.outputs.files - `string` - The names all new, updated, and deleted files. The output is dependant on the output input, default is a json string. +steps.file_changes.outputs.files - `string` - The names all new, updated, and removed files. The output is dependant on the output input, default is a json string. ### files_added @@ -54,9 +54,9 @@ steps.file_changes.outputs.files_added - `string` - The names of the newly creat steps.file_changes.outputs.files_modified - `string` - The names of the updated files. The output is dependant on the output input, default is a json string. -### files_deleted +### files_removed -steps.file_changes.outputs.files_deleted - `string` - The names of the deleted files. The output is dependant on the output input, default is a json string. +steps.file_changes.outputs.files_removed - `string` - The names of the removed files. The output is dependant on the output input, default is a json string. ## Example usage @@ -106,9 +106,9 @@ If a push is made then it will compare commits from the SHA `github.payload.befo After gathering this information it will output the files in 2 ways. -- As an output variable, you can use this variable by using `steps.file_changes_outputs_files`, `steps.file_changes.outputs.files_modified`, `steps.file_changes.outputs.files_added`, `steps.file_changes.outputs.files_deleted`. +- As an output variable, you can use this variable by using `steps.file_changes_outputs_files`, `steps.file_changes.outputs.files_modified`, `steps.file_changes.outputs.files_added`, `steps.file_changes.outputs.files_removed`. -- As a file on the container stored at `$HOME/files.json`, `$HOME/files_modified.json`, `$HOME/files_added.json`, `$HOME/files_deleted.json`. +- As a file on the container stored at `$HOME/files.json`, `$HOME/files_modified.json`, `$HOME/files_added.json`, `$HOME/files_removed.json`. - _NOTE:_ If you set a custom delimiter in output or fileOutput inputs then you will receive different files. For example a delimiter of ',' will output at `$HOME/files.csv` instead of `$HOME/files.json`. Likewise, anything other than 'json' or ',' delmiters will output `$HOME/files.txt` files instead of `$HOME/files.json` by default. @@ -138,11 +138,11 @@ jobs: cat $HOME/files.json cat $HOME/files_modified.json cat $HOME/files_added.json - cat $HOME/files_deleted.json + cat $HOME/files_removed.json echo '${{ steps.file_changes.outputs.files}}' echo '${{ steps.file_changes.outputs.files_modified}}' echo '${{ steps.file_changes.outputs.files_added}}' - echo '${{ steps.file_changes.outputs.files_deleted}}' + echo '${{ steps.file_changes.outputs.files_removed}}' ``` You can set the output and fileOutput to ',' for csv output. diff --git a/action.yml b/action.yml index f041e4e8..aa4a706f 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ name: 'File Changes Action' -description: 'Creates outputs variables of files modified, added, or deleted by a PR or Push.' +description: 'Creates outputs variables of files modified, added, or removed by a PR or Push.' author: 'Bryan Killian ' inputs: githubRepo: @@ -26,13 +26,13 @@ inputs: required: false outputs: files: - description: 'The names all new, updated, and deleted files' + description: 'The names all new, updated, and removed files' files_added: description: 'The names of the newly created files' files_modified: description: 'The names of the updated files' - files_deleted: - description: 'The names of the deleted files' + files_removed: + description: 'The names of the removed files' runs: using: 'node12' main: 'dist/index.js' diff --git a/package.json b/package.json index fc0cef2f..eb99927e 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "engines": { "node": "12.16.1" }, - "description": "Creates outputs variables of files modified, added, or deleted by a PR or Push.", + "description": "Creates outputs variables of files modified, added, or removed by a PR or Push.", "main": "lib/main.js", "scripts": { "build": "yarn && tsc", diff --git a/src/FilesHelper.ts b/src/FilesHelper.ts index 93683059..24775b4c 100644 --- a/src/FilesHelper.ts +++ b/src/FilesHelper.ts @@ -7,7 +7,7 @@ import {getErrorString} from './UtilsHelper' /** * @function sortChangedFiles * @param files pass in array of GithubFile's to be sorted - * @returns ChangedFiles object that has .files, .added, .modified, and .deleted + * @returns ChangedFiles object that has .files, .added, .modified, and .removed */ export function sortChangedFiles(files: GitHubFile[]): ChangedFiles { try { @@ -78,7 +78,7 @@ export function formatChangedFiles(format: string, files: string[]): string { /** * @function writeFiles * @param format output format 'json' will stringify anything else will files.join('string') - * @param key changedFiles type added, modified, deleted, or files + * @param key changedFiles type added, modified, removed, or files * @param files string list of files to format * @returns string output to be stored in file */ @@ -113,7 +113,7 @@ export function writeFiles(format: string, key: string, files: string[]): void { /** * @function writeOutput * @param format output format 'json' will stringify anything else will files.join('string') - * @param key changedFiles type added, modified, deleted, or files + * @param key changedFiles type added, modified, removed, or files * @param files string list of files to format * @returns string output to be stored to action output */ diff --git a/src/tests/mocks/octokit/payloads.ts b/src/tests/mocks/octokit/payloads.ts index 868a3e9d..fa255b6e 100644 --- a/src/tests/mocks/octokit/payloads.ts +++ b/src/tests/mocks/octokit/payloads.ts @@ -141,7 +141,7 @@ export const weirdFileArray: string[] = [ ".github/actions/deploy_infrastruc1234'ture/deploy.sh", '.github/actions/make_commands/&&&index.js', '.github/actions/make_comdf&*(@mands/test/files_added.json', - '.github/actions/make_c``ommands/test/files_deleted.json', + '.github/actions/make_c``ommands/test/files_removed.json', '.github/actions/make commands/test/files_modified.json', '.pre-commit-config.yaml', 'cloudformation/Makefile',