From 58a81c5c4c759538c3e107ec52a6051b4f7c78e3 Mon Sep 17 00:00:00 2001 From: Tonye Jack Date: Mon, 30 May 2022 22:46:18 -0400 Subject: [PATCH] chore: Update README.md (#510) * Update README.md * Update README.md --- README.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/README.md b/README.md index 8117833c..1d1e95b4 100644 --- a/README.md +++ b/README.md @@ -285,9 +285,53 @@ Support this project with a :star: uses: tj-actions/changed-files@v21 with: quotepath: "false" + + # Run changed-files action using the last successful commit as the base_sha + # NOTE: This setting overrides the commit sha used by setting since_last_remote_commit to true. + # It is recommended to use either solutions that works for your use case. + + # Push event based workflows + - name: Get branch name + id: branch-name + uses: tj-actions/branch-names@v5 + + - uses: nrwl/last-successful-commit-action@v1 + id: last_successful_commit_push + with: + branch: ${{ steps.branch-name.outputs.current_branch }} # Get the last successful commit for the current branch. + workflow_id: 'test.yml' + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Run changed-files with the commit of the last successful test workflow run + id: changed-files-base-sha-push + uses: tj-actions/changed-files@v21 + with: + base_sha: ${{ steps.last_successful_commit_push.outputs.commit_hash }} + + # Pull request based workflows. + - name: Get branch name + id: branch-name + uses: tj-actions/branch-names@v5 + if: github.event_name == 'pull_request' + + - uses: nrwl/last-successful-commit-action@v1 + id: last_successful_commit_pull_request + if: github.event_name == 'pull_request' + with: + branch: ${{ steps.branch-name.outputs.base_ref_branch }} # Get the last successful commit on master or main branch + workflow_id: 'test.yml' + github_token: ${{ secrets.GITHUB_TOKEN }} + + - name: Run changed-files with the commit of the last successful test workflow run on main + if: github.event_name == 'pull_request' + id: changed-files-base-sha-pull-request + uses: tj-actions/changed-files@v21 + with: + base_sha: ${{ steps.last_successful_commit_pull_request.outputs.commit_hash }} ``` + Screen Shot 2021-11-19 at 4 59 21 PM * Free software: [MIT license](LICENSE)