Skip to content

Commit dbcc82a

Browse files
Copilotmsyyc
andauthored
Fix TypeSpec Python regenerate workflow to fetch README template from typespec-python-generated-tests branch
Co-authored-by: msyyc <70930885+msyyc@users.noreply.github.com>
1 parent b5aae50 commit dbcc82a

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

.github/workflows/typespec-python-regenerate.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,21 @@ jobs:
143143
run: rm -rf "_typespec"
144144

145145
- name: Apply README template to generated test packages
146+
env:
147+
GH_TOKEN: ${{ github.token }}
146148
run: |
147149
set -euo pipefail
148150
TARGET="eng/tools/azure-sdk-tools/emitter/generated"
149-
TEMPLATE="$TARGET/template/README.md"
150-
if [ ! -f "$TEMPLATE" ]; then
151-
echo "::error::Template README not found at $TEMPLATE"
151+
# The emitter/generated directory (including the README template) was
152+
# removed from main by design (PR #47288); it now lives only on the
153+
# typespec-python-generated-tests branch. Fetch the template from there
154+
# rather than expecting it in the main checkout.
155+
TARGET_BRANCH="typespec-python-generated-tests"
156+
TEMPLATE_PATH="$TARGET/template/README.md"
157+
TEMPLATE="$(mktemp)"
158+
if ! git fetch --no-tags --depth=1 origin "$TARGET_BRANCH" 2>/dev/null \
159+
|| ! git show "FETCH_HEAD:$TEMPLATE_PATH" > "$TEMPLATE" 2>/dev/null; then
160+
echo "::error::Template README not found at $TEMPLATE_PATH on branch $TARGET_BRANCH"
152161
exit 1
153162
fi
154163
# Replace every README.md under generated/ with the template, except:
@@ -159,6 +168,7 @@ jobs:
159168
! -path "$TARGET/README.md" \
160169
! -path "$TARGET/template/*" \
161170
-print -exec cp -f "$TEMPLATE" {} \;
171+
rm -f "$TEMPLATE"
162172
163173
- name: Create or update tracking issue with PR link
164174
env:

0 commit comments

Comments
 (0)