Skip to content

Latest commit

 

History

History
98 lines (72 loc) · 2.39 KB

command.md

File metadata and controls

98 lines (72 loc) · 2.39 KB

Command GitVersion Action (gitversion/command) usage Examples

Find out how to use the gitversion/command action using the examples below.

Note that if the pipeline is set up to use a shallow git fetch mode the GitVersion Command action will fail. It is required to use fetch-depth: 0. You must also run the GitVersion Setup step before the Command step:

steps:
  - name: Checkout
    uses: actions/checkout@v4
    with:
      fetch-depth: 0

  - name: Install GitVersion
    uses: gittools/actions/gitversion/[email protected]
    with:
      versionSpec: '6.0.x'

These steps are omitted from the examples for brevity.

The examples use version 3.1.11 of the GitVersion Command action. It is recommended to use the latest released version in your own workflows.

Inputs

The Command GitVersion action accepts the following inputs:

targetPath:
  description: Optionally supply the path to the working directory
  required: false
  default: ''
disableShallowCloneCheck:
  description: Whether to disable the check for shallow clone
  required: false
  default: 'false'
arguments:
  description: Arguments to send to GitVersion
  required: true
  default: ''

Execution Examples

Example 1

Show the effective configuration for GitVersion by running the /showConfig command.
steps:
  # gittools/actions/gitversion/[email protected] action omitted for brevity.

  - name: Display GitVersion config
    uses: gittools/actions/gitversion/[email protected]
    with:
      useConfigFile: true
      arguments: '/showConfig'

Example 2

Outputs the FullSemVer variable by running the /showvariable FullSemVer command.
steps:
  # gittools/actions/gitversion/[email protected] action omitted for brevity.

  - name: Output the FullSemVer variable
    uses: gittools/actions/gitversion/[email protected]
    with:
      arguments: '/showvariable FullSemVer'

Example 3

Outputs the formatted version by running the /format {Major}.{Minor} command.
steps:
  # gittools/actions/gitversion/[email protected] action omitted for brevity.

  - name: Output the formatted version
    uses: gittools/actions/gitversion/[email protected]
    with:
      arguments: '/format {Major}.{Minor}' # any Output Variable can be used here