Skip to content

Commit 5955e4a

Browse files
committed
Fixed checkout and changed commit, push strategy
1 parent f3f268e commit 5955e4a

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

.github/workflows/update-automation.yaml

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,22 @@ jobs:
1515
- name: Checkout code
1616
uses: actions/checkout@v4
1717
with:
18+
fetch-depth: 0
1819
submodules: true
1920

21+
- name: Get latest semver branch
22+
run: |
23+
git fetch origin
24+
LATEST_SEMVER=$(git branch -r | grep -E 'origin/[0-9]+\.[0-9]+\.[0-9]+$' | sed 's/.*origin\///' | sort -V | tail -1)
25+
if [ -z "$LATEST_SEMVER" ]; then
26+
LATEST_SEMVER="main"
27+
echo "No semver branches found, using main"
28+
fi
29+
echo "LATEST_SEMVER=$LATEST_SEMVER" >> $GITHUB_ENV
30+
echo "Using branch: $LATEST_SEMVER"
31+
git checkout "$LATEST_SEMVER"
32+
git submodule update --init --recursive
33+
2034
- name: Check if update needed
2135
run: |
2236
cd third-party-src
@@ -56,16 +70,15 @@ jobs:
5670
git checkout "$LATEST_TAG"
5771
cd ..
5872
59-
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
60-
echo "STAGING_BRANCH=$STAGING_BRANCH" >> $GITHUB_ENV
61-
fi
73+
# Configure git user and commit changes
74+
git config user.name "github-actions[bot]"
75+
git config user.email "github-actions[bot]@users.noreply.github.com"
6276
63-
- name: Commit and push changes
64-
uses: EndBug/add-and-commit@v9
65-
with:
66-
add: 'third-party-src'
67-
message: 'Update VS Code submodule to ${{ env.LATEST_TAG }}'
68-
new_branch: ${{ env.STAGING_BRANCH }}
69-
default_author: github_actions
77+
git add third-party-src
78+
git commit -m "Update VS Code submodule to $LATEST_TAG"
79+
git push origin "$STAGING_BRANCH"
80+
81+
echo "✅ Created staging branch: $STAGING_BRANCH with VS Code $LATEST_TAG"
82+
fi
7083
7184

0 commit comments

Comments
 (0)