Skip to content

Commit 011af9d

Browse files
authored
Merge pull request #20 from menloresearch/m/chore/ci
ci: update tag upstream sync
2 parents e84e827 + 2d03297 commit 011af9d

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

.github/workflows/upstream-sync.yml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
- name: Checkout repository
1717
uses: actions/checkout@v4
1818
with:
19-
fetch-depth: 0
19+
fetch-depth: 0 # Fetch all history for all branches and tags
2020
token: ${{ secrets.PAT_SERVICE_ACCOUNT }}
2121
ref: master
2222

@@ -37,14 +37,20 @@ jobs:
3737
fi
3838
echo "LATEST_TAG=$LATEST_TAG" >> $GITHUB_ENV
3939
40-
# Update master branch
41-
git fetch upstream $LATEST_TAG --depth=1
40+
# Fetch complete history from upstream
41+
git fetch upstream --unshallow || git fetch upstream
42+
43+
# Update master branch with latest release
44+
git fetch upstream $LATEST_TAG
4245
git checkout -B master FETCH_HEAD
46+
47+
# Push the updated master branch
4348
git push origin master --force
4449
45-
# Count commits for tagging - this is the master branch commit count
50+
# Count all commits for tagging
4651
COMMIT_COUNT=$(git rev-list --count HEAD)
4752
echo "COMMIT_COUNT=$COMMIT_COUNT" >> $GITHUB_ENV
53+
echo "Total commits in master branch: $COMMIT_COUNT"
4854
4955
- name: Create PR to dev
5056
id: create_pr
@@ -149,17 +155,14 @@ jobs:
149155
echo "PR merged successfully!"
150156
151157
# Create tag using master branch commit count
152-
TAG_NAME="$COMMIT_COUNT"
153-
154-
# Checkout dev to apply the tag
155-
git fetch origin dev
156-
git checkout dev
158+
TAG_NAME="b$COMMIT_COUNT"
157159
158160
# Check if tag exists
159161
if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then
160162
echo "Tag $TAG_NAME already exists"
161163
else
164+
# Create tag on the current commit (master branch HEAD)
162165
git tag "$TAG_NAME"
163166
git push origin "$TAG_NAME"
164-
echo "Tag $TAG_NAME created successfully"
167+
echo "Tag $TAG_NAME created successfully (total commits: $COMMIT_COUNT)"
165168
fi

0 commit comments

Comments
 (0)