|
16 | 16 | description: "Either 'main' (microsoft/typespec@main) or a microsoft/typespec pull request URL (e.g. https://github.com/microsoft/typespec/pull/1234). The PR's head repo + SHA will be checked out." |
17 | 17 | required: false |
18 | 18 | default: "main" |
| 19 | + target_branch: |
| 20 | + description: "Branch to push regenerated tests to. Defaults to 'typespec-python-generated-tests'." |
| 21 | + required: false |
| 22 | + default: "typespec-python-generated-tests" |
19 | 23 |
|
20 | 24 | permissions: |
21 | 25 | contents: write |
@@ -148,19 +152,23 @@ jobs: |
148 | 152 | echo "::error::Template README not found at $TEMPLATE" |
149 | 153 | exit 1 |
150 | 154 | fi |
151 | | - # Replace every README.md under generated/ with the template, except: |
152 | | - # - the top-level generated/README.md |
153 | | - # - anything under generated/template/ (the template itself and any |
154 | | - # future siblings) |
155 | | - find "$TARGET" -type f -name README.md \ |
156 | | - ! -path "$TARGET/README.md" \ |
157 | | - ! -path "$TARGET/template/*" \ |
158 | | - -print -exec cp -f "$TEMPLATE" {} \; |
| 155 | + # Place a README.md in every package directory under azure/ and |
| 156 | + # unbranded/ (top-level subdirectories only). This ensures newly |
| 157 | + # generated packages get a README, not just pre-existing ones. |
| 158 | + for flavor in azure unbranded; do |
| 159 | + flavor_dir="$TARGET/$flavor" |
| 160 | + [ -d "$flavor_dir" ] || continue |
| 161 | + for pkg_dir in "$flavor_dir"/*/; do |
| 162 | + [ -d "$pkg_dir" ] || continue |
| 163 | + cp -f "$TEMPLATE" "$pkg_dir/README.md" |
| 164 | + echo " $pkg_dir/README.md" |
| 165 | + done |
| 166 | + done |
159 | 167 |
|
160 | 168 | - name: Commit and push to dedicated branch |
161 | 169 | run: | |
162 | 170 | set -euo pipefail |
163 | | - BRANCH="typespec-python-generated-tests" |
| 171 | + BRANCH="${{ github.event.inputs.target_branch || 'typespec-python-generated-tests' }}" |
164 | 172 | git config user.name "github-actions[bot]" |
165 | 173 | git config user.email "github-actions[bot]@users.noreply.github.com" |
166 | 174 |
|
|
0 commit comments