diff --git a/.github/actions/git-tag/README.md b/.github/actions/git-tag/README.md index 7912751..c52e55e 100644 --- a/.github/actions/git-tag/README.md +++ b/.github/actions/git-tag/README.md @@ -17,6 +17,7 @@ steps: uses: NVIDIA/dsx-github-actions/.github/actions/git-tag@main with: tag: "v1.0.0" + github_token: ${{ secrets.GITHUB_TOKEN }} ``` ## Inputs @@ -24,6 +25,7 @@ steps: | Input | Description | Required | Default | | :--- | :--- | :--- | :--- | | `tag` | The tag name to create and push. | `true` | N/A | +| `github_token` | GitHub token for git authentication. Use a PAT to trigger subsequent workflows. | `true` | N/A | ## Behavior diff --git a/.github/actions/git-tag/action.yml b/.github/actions/git-tag/action.yml index afad11d..96814af 100644 --- a/.github/actions/git-tag/action.yml +++ b/.github/actions/git-tag/action.yml @@ -4,7 +4,9 @@ inputs: tag: description: "The tag name to create and push" required: true - + github_token: + description: "GitHub token for git tag. Use a PAT to trigger subsequent workflows." + required: true runs: using: "composite" steps: @@ -12,5 +14,6 @@ runs: shell: bash env: INPUT_TAG: ${{ inputs.tag }} + INPUT_GITHUB_TOKEN: ${{ inputs.github_token }} run: | "${{ github.action_path }}/scripts/tag.sh" diff --git a/.github/actions/git-tag/scripts/tag.sh b/.github/actions/git-tag/scripts/tag.sh index a79b101..ba3ee85 100755 --- a/.github/actions/git-tag/scripts/tag.sh +++ b/.github/actions/git-tag/scripts/tag.sh @@ -49,7 +49,12 @@ main() { fi log_info "Pushing tag: $tag" - git push origin "$tag" + + if [[ -n "${INPUT_GITHUB_TOKEN:-}" ]]; then + git push "https://${INPUT_GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" "$tag" + else + git push origin "$tag" + fi } main "$@"