Skip to content

Commit 5990fbb

Browse files
authored
release-vfsforgit: fix heredoc and add workflow_dispatch trigger (#884)
This fixes the failure in https://github.com/microsoft/git/actions/runs/24558034660/job/71799344023 and adds a `workflow_dispatch` trigger so the workflow can be re-run manually without creating a new release. **Commit 1**: Replace the broken heredoc (`cat <<EOF`) with a simple quoted string. The heredoc failed because the YAML `run: |` block preserves indentation, so the closing `EOF` delimiter was never at column 0. **Commit 2**: Add `workflow_dispatch` with a `tag` input (same pattern as the winget workflow), and consolidate the tag into a single `TAG_NAME` env var set at workflow level.
2 parents 93396a6 + aa5b514 commit 5990fbb

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

.github/workflows/release-vfsforgit.yml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,23 @@ on:
44
release:
55
types: [released]
66

7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: 'Tag name to release'
11+
required: true
12+
713
permissions:
814
id-token: write # required for Azure login via OIDC
915

16+
env:
17+
TAG_NAME: ${{ github.event.inputs.tag || github.event.release.tag_name }}
18+
1019
jobs:
1120
update:
1221
runs-on: ubuntu-latest
1322
environment: release
1423
steps:
15-
- name: Compute tag name
16-
id: tag
17-
run: echo "name=${{ github.event.release.tag_name }}" >>$GITHUB_OUTPUT
18-
1924
- name: Log into Azure
2025
uses: azure/login@v2
2126
with:
@@ -48,9 +53,8 @@ jobs:
4853
gh auth setup-git
4954
gh config set git_protocol https
5055
51-
TAG="${{ steps.tag.outputs.name }}"
5256
REPO="microsoft/VFSForGit"
53-
BRANCH="automation/gitrelease-$TAG"
57+
BRANCH="automation/gitrelease-$TAG_NAME"
5458
FILE=".github/workflows/build.yaml"
5559
5660
# Clone VFS for Git repo (sparse partial clone for efficiency)
@@ -63,28 +67,25 @@ jobs:
6367
git checkout -b "$BRANCH"
6468
6569
# Update the GIT_VERSION default in build.yaml
66-
sed -i "/GIT_VERSION/s/|| '[^']*' }}/|| '$TAG' }}/" "$FILE"
70+
sed -i "/GIT_VERSION/s/|| '[^']*' }}/|| '$TAG_NAME' }}/" "$FILE"
6771
6872
# Verify the change was made
6973
if ! git diff --quiet "$FILE"; then
7074
git config user.name "github-actions[bot]"
7175
git config user.email "github-actions[bot]@users.noreply.github.com"
7276
7377
git add "$FILE"
74-
git commit -m "Update default Microsoft Git version to $TAG"
78+
git commit -m "Update default Microsoft Git version to $TAG_NAME"
7579
7680
# Push the new branch
7781
git push origin "$BRANCH"
7882
7983
# Create the PR
8084
WORKFLOW_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
81-
RELEASE_URL="https://github.com/microsoft/git/releases/tag/$TAG"
82-
PR_TITLE="Update default Microsoft Git version to $TAG"
83-
PR_BODY=$(cat <<EOF
84-
This PR was automatically created by the [microsoft/git release workflow]($WORKFLOW_URL)
85-
to update the default Microsoft Git version to [\`$TAG\`]($RELEASE_URL).
86-
EOF
87-
)
85+
RELEASE_URL="https://github.com/microsoft/git/releases/tag/$TAG_NAME"
86+
PR_TITLE="Update default Microsoft Git version to $TAG_NAME"
87+
PR_BODY="This PR was automatically created by the [microsoft/git release workflow]($WORKFLOW_URL)
88+
to update the default Microsoft Git version to [\`$TAG_NAME\`]($RELEASE_URL)."
8889
8990
PR_URL=$(gh pr create \
9091
--repo "$REPO" \
@@ -93,5 +94,5 @@ jobs:
9394
--body "$PR_BODY")
9495
echo "::notice::Created VFS for Git PR: $PR_URL"
9596
else
96-
echo "::warning::No changes detected in $FILE; GIT_VERSION may already be set to $TAG"
97+
echo "::warning::No changes detected in $FILE; GIT_VERSION may already be set to $TAG_NAME"
9798
fi

0 commit comments

Comments
 (0)