-
Notifications
You must be signed in to change notification settings - Fork 739
Add automated workflow for templates localization strings updates #12707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Added MSBuild target CheckTemplateStringsNotModified that runs after build - Target uses PowerShell script to detect uncommitted changes to templatestrings files - Build fails with clear error message if any templatestrings files are modified - Includes instructions on how to fix the issue - Works in both local and CI environments - Committed the templatestrings file changes that were generated by the build Co-authored-by: sebastienros <1165805+sebastienros@users.noreply.github.com>
- Removed MSBuild target from Aspire.ProjectTemplates.csproj - Added check_templatestrings job to .github/workflows/tests.yml - Check runs after build_packages job - Added as dependency to Final Test Results job - Uses bash script to check for modified templatestrings files - Fails CI if any templatestrings files have uncommitted changes Co-authored-by: sebastienros <1165805+sebastienros@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 12707Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 12707" |
.github/workflows/tests.yml
Outdated
| path: extension/out/aspire-extension.vsix | ||
|
|
||
| check_templatestrings: | ||
| name: Check templatestrings files not modified |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot this should be conditioned to run only for PRs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in commit 619fe78. Added condition if: ${{ github.event_name == 'pull_request' }} to the job so it only runs for PRs.
.github/workflows/tests.yml
Outdated
| # Check failed - there are modified files | ||
| echo "" | ||
| echo "================================================================================" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot This whole message should be posted as a comment on the PR too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in commit 619fe78. The error message is now captured in GITHUB_OUTPUT and posted as a PR comment using github-script action when the check fails. The message is formatted as markdown for better readability.
… failure - Added condition to run check_templatestrings only for pull_request events - Modified check to capture error message in GITHUB_OUTPUT - Added github-script step to post error message as PR comment on failure - Error message formatted as markdown for better readability in PR comments Co-authored-by: radical <1472+radical@users.noreply.github.com>
.github/workflows/tests.yml
Outdated
| - name: Checkout code | ||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
|
|
||
| - name: Check for modified templatestrings files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot before this step, run ./restore.sh and then ./dotnet.sh build ${{ github.workspace }}/src/Aspire.ProjectTemplates/Aspire.ProjectTemplates.csproj /bl:${{ github.workspace }}/artifacts/log/Debug/BuildTemplates.binlog. This build would make any localization updates if needed, which would allow the next step to run correctly. Also, add a step at the end to upload the binlog .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in commit ec284ce. Added:
./restore.shstep before the check- Build step:
./dotnet.sh build ${{ github.workspace }}/src/Aspire.ProjectTemplates/Aspire.ProjectTemplates.csproj /bl:${{ github.workspace }}/artifacts/log/Debug/BuildTemplates.binlog - Upload binlog step at the end (runs always with
if: always())
- Added ./restore.sh step before checking files - Added build step for ProjectTemplates project with binlog output - Added step to upload binlog artifact (always runs) - This ensures the build runs and can modify templatestrings before checking Co-authored-by: radical <1472+radical@users.noreply.github.com>
.github/workflows/tests.yml
Outdated
| check_templatestrings: | ||
| name: Check templatestrings files not modified | ||
| runs-on: ubuntu-latest | ||
| needs: build_packages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| needs: build_packages |
@copilot the dependency is not required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in commit d003d3a. Removed the needs: build_packages dependency since the job now runs its own restore and build steps.
The check_templatestrings job runs its own restore and build steps, so it doesn't need to wait for build_packages to complete. This allows the check to run in parallel with other jobs. Co-authored-by: radical <1472+radical@users.noreply.github.com>
|
@copilot the check fails with: |
The error message was being directly embedded in a JavaScript template literal, which caused syntax errors when the message contained backticks or other special characters. Now passing it through the env context and accessing via process.env.ERROR_MESSAGE. Co-authored-by: radical <1472+radical@users.noreply.github.com>
... Fixed in commit 280ad5b. The error was caused by embedding the error message directly in a JavaScript template literal. When the message contained backticks (from the markdown formatting), it broke the JavaScript syntax. Now passing the message through the |
|
@copilot we need to rework this because posting a comment from the PR needs permissions which are too broad. Instead do this:
|
- Reverted all changes to .github/workflows/tests.yml - Created new workflow .github/workflows/update-templates-localization-strings.yml - New workflow builds ProjectTemplates and creates PR with templatestrings.*.json changes - Runs on schedule (daily) and manual dispatch - Uses dotnet/actions-create-pull-request with path-filters for templatestrings files only Co-authored-by: radical <1472+radical@users.noreply.github.com>
Done in commit e139d4a. Created new workflow
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a new GitHub Actions workflow that automatically generates and updates template localization strings on a daily schedule. The workflow builds the ProjectTemplates project to regenerate localization files and creates/updates a pull request with any changes.
Key Changes:
- Adds automated daily workflow to update template localization strings
- Configures PR creation with appropriate labels and targeting for localization file changes
| run: ./restore.sh | ||
|
|
||
| - name: Build ProjectTemplates to update localization strings | ||
| run: ./dotnet.sh build ${{ github.workspace }}/src/Aspire.ProjectTemplates/Aspire.ProjectTemplates.csproj /bl:${{ github.workspace }}/artifacts/log/Debug/BuildTemplates.binlog |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The binlog path hardcodes 'Debug' configuration, but the build command doesn't specify a configuration. This could cause inconsistency if the build defaults to a different configuration. Consider either adding -c Debug to the build command or using a configuration-agnostic path like ${{ github.workspace }}/artifacts/log/BuildTemplates.binlog.
| run: ./dotnet.sh build ${{ github.workspace }}/src/Aspire.ProjectTemplates/Aspire.ProjectTemplates.csproj /bl:${{ github.workspace }}/artifacts/log/Debug/BuildTemplates.binlog | |
| run: ./dotnet.sh build ${{ github.workspace }}/src/Aspire.ProjectTemplates/Aspire.ProjectTemplates.csproj -c Debug /bl:${{ github.workspace }}/artifacts/log/Debug/BuildTemplates.binlog |
| title: "[Automated] Update templates localization strings" | ||
| body: "Auto-generated update of template localization strings (templatestrings.*.json files)." | ||
| path-filters: | | ||
| src/Aspire.ProjectTemplates/templates/*templatestrings.*.json |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path filter pattern uses a single wildcard which may not match files in subdirectories. According to the custom coding guidelines, localization files match the pattern */localize/templatestrings.*.json. The current pattern templates/*templatestrings.*.json may not correctly capture files in the localize subdirectories. Consider using src/Aspire.ProjectTemplates/templates/*/localize/templatestrings.*.json to match the actual file structure.
| src/Aspire.ProjectTemplates/templates/*templatestrings.*.json | |
| src/Aspire.ProjectTemplates/templates/*/localize/templatestrings.*.json |
Description
This PR implements an automated workflow to detect and commit localization string updates from building the Aspire.ProjectTemplates project.
Changes
.github/workflows/update-templates-localization-strings.ymlsrc/Aspire.ProjectTemplates/templates/*templatestrings.*.jsonfiles onlyarea-templatesandarea-engineering-systemsdotnet/actions-create-pull-requestaction with path filters to include only templatestrings filesHow It Works
Benefits
Checklist
Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.