This is an automated email from the ASF dual-hosted git repository. sjaranowski pushed a commit to branch v2-docs in repository https://gitbox.apache.org/repos/asf/maven-gh-actions-shared.git
commit 01335e7c8f3d8eb8e1ea4e0015adfe37714f4304 Author: Slawomir Jaranowski <[email protected]> AuthorDate: Sun Jan 2 20:17:32 2022 +0100 Shared action v2 - more examples of configuration --- README.md | 48 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 43 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 90f31c6..ffb22e4 100644 --- a/README.md +++ b/README.md @@ -49,22 +49,44 @@ name: Verify on: push: - branches-ignore: - - dependabot/** pull_request: jobs: build: name: Verify - uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v1 + uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v2 ``` +## Events that can trigger workflows -Excludes from build matrix: +In such configuration workflow can be executed in the same time twice for two separate events. + +It can occurs when we create PR for branch from the same repository, we have two events: +- `push` on branch +- `pull_request` on PR for the same branch + +In order to minimize resource consumptions shared workflow from version `v2` +detect such situation and skips the execution for `pull_request` event +if `PR` is created for local branch. + +# Additional configurations + +## Attach logs on failure + +We can store some logs of execution in case of failure as workflow attachments: + +```yaml +... + uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v2 + with: + failure-upload-path: | + **/target/surefire-reports/* +``` +## Excludes from build matrix: ```yaml ... - uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v1 + uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v2 with: matrix-exclude: > [ @@ -74,6 +96,22 @@ Excludes from build matrix: ] ``` +## Change default goals + +```yaml +... + uses: apache/maven-gh-actions-shared/.github/workflows/maven-verify.yml@v2 + with: + ff-goal: 'install' + verify-goal: 'install -P run-its' +``` + +## More options + +More options with default values can be found in workflow source in `inputs` section: + +https://github.com/apache/maven-gh-actions-shared/blob/v2/.github/workflows/maven-verify.yml + # Resources - [Workflow syntax](https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions)
