From 5f050e0b7a874ed2e299ddb87569384cf460cfa1 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Tue, 4 May 2021 13:53:26 -0400 Subject: [PATCH] Update README.md --- README.md | 78 +++++++++++++++++++++++++++---------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index ef681da5..f81cfa6f 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,45 @@ Get all modified files relative to the default branch (`pull_request*` events) o - Regex pattern matching on a subset of files. +## Usage + +> NOTE: :warning: +> * For `push` events to work you need to include `fetch-depth: 0` **OR** `fetch-depth: 2` depending on your use case. + + + +```yaml +name: CI + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + name: Test changed-files + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v5.1 + + - name: List all modified files + run: | + for file in "${{ steps.changed-files.outputs.all_modified_files }}"; do + echo "$file was modified" + done +``` + + ## Outputs Using the default separator. @@ -56,45 +95,6 @@ Using the default separator. | files | `string OR string[]` | `false` | | Restricted list of specific files to watch for changes | -## Usage - -> NOTE: :warning: -> * For `push` events to work you need to include `fetch-depth: 0` **OR** `fetch-depth: 2` depending on your use case. - - - -```yaml -name: CI - -on: - push: - branches: - - main - pull_request: - branches: - - main - -jobs: - build: - runs-on: ubuntu-latest - name: Test changed-files - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 # OR "2" -> To retrieve the preceding commit. - - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v5.1 - - - name: List all modified files - run: | - for file in "${{ steps.changed-files.outputs.all_modified_files }}"; do - echo "$file was modified" - done -``` - - ## Example ```yaml