Skip to content
Merged
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
19 changes: 14 additions & 5 deletions .github/workflows/typespec-python-regenerate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ jobs:
with:
fetch-depth: 0

- name: Configure git author
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"

- name: Resolve TypeSpec repo/ref
id: typespec-info
env:
Expand Down Expand Up @@ -109,8 +114,6 @@ jobs:
working-directory: _typespec
run: |
set -euo pipefail
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# The checkout's "origin" points at the PR head repo (possibly a
# fork), so add microsoft/typespec explicitly to fetch its main.
if git remote get-url upstream >/dev/null 2>&1; then
Expand Down Expand Up @@ -175,11 +178,19 @@ jobs:
else
SOURCE_BRANCH="regen/typespec-python-main"
fi
if ! git fetch --no-tags --depth=1 origin "$TARGET_BRANCH" 2>/dev/null; then
if ! git fetch --no-tags origin "$TARGET_BRANCH" 2>/dev/null; then
echo "::error::Branch $TARGET_BRANCH not found. Initialize it from the generated-tests history before rerunning this workflow."
exit 1
fi
git checkout -B "$SOURCE_BRANCH" "origin/$TARGET_BRANCH"
if [ -z "$PR_NUMBER" ]; then
git fetch --no-tags origin main
if ! git merge --no-edit origin/main; then
git merge --abort || true
echo "::error::Branch $TARGET_BRANCH conflicts with main. Please update $TARGET_BRANCH by merging the latest main and resolving conflicts, then re-run this workflow."
exit 1
fi
fi
Comment thread
msyyc marked this conversation as resolved.

- name: Copy regenerated tests
run: |
Expand Down Expand Up @@ -218,8 +229,6 @@ jobs:
run: |
set -euo pipefail
TARGET_BRANCH="typespec-python-generated-tests"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

GENERATED_DIR="eng/tools/azure-sdk-tools/emitter/generated"

Expand Down
Loading