Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repro: GitTools/action with UNDEFINED setup output #1

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions .github/workflows/4350-gitversion-undefined.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Issue 4350 repro

on:
push:
branches:
- example-undefined

jobs:
gitversion-tool:
runs-on: ubuntu-latest

steps:

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

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "9.x"
dotnet-quality: "ga"

- name: Install GitVersion.Tool
run: |
dotnet tool install --global GitVersion.Tool --version 6.0.5

- name: Show GitVersion config
run: dotnet gitversion -config GitVersion.yml -showconfig

- name: Execute GitVersion and generate summary
run: |
OUTPUT=$(dotnet-gitversion -config GitVersion.yml -output json)
echo "$OUTPUT"

{
echo "| Variable | Output |"
echo "| :--- | :--- |"
echo "$OUTPUT" | jq -r 'to_entries | sort_by(.key) | .[] | "| \(.key) | \(.value) |"'
} >> $GITHUB_STEP_SUMMARY

actions-gitversion:
runs-on: ubuntu-latest

steps:

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

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "9.x"
dotnet-quality: "ga"

- name: Setup GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '6.0.5'

- name: Execute GitVersion
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
configFilePath: GitVersion.yml

- name: Generate summary
run: |
# Create JSON from GitVersion environment variables
{
echo "{"
first=true
for var in $(env | grep "^GitVersion_" | sort); do
key=$(echo "$var" | cut -d= -f1 | sed 's/^GitVersion_//')
value=$(echo "$var" | cut -d= -f2-)
if [ "$first" = true ]; then
first=false
else
echo ","
fi
echo " \"$key\": \"$value\""
done
echo "}"
} > gitversion.json

# Generate summary table
{
echo "| Variable | Output |"
echo "| :--- | :--- |"
jq -r 'to_entries | sort_by(.key) | .[] | "| \(.key) | \(.value) |"' gitversion.json
} >> $GITHUB_STEP_SUMMARY
Loading