Skip to content
Merged
Show file tree
Hide file tree
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
18 changes: 18 additions & 0 deletions .github/actions/codegen/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# This repository's codegen hook, run by the hub's run-codegen-pull-request-task.yml.
# The task owns the App token, the SDK install, the checkout, the CSharpier format, and the per-branch pull request.
# This hook carries only the generator invocation, which is the one part of that sequence that is this repository's own.
name: Run codegen (LanguageTags)
description: Regenerate the embedded ISO 639, RFC 5646, and UN M.49 data from the upstream registries.

runs:
using: composite
steps:

# No --skip-download here, unlike the drift guard in the validate hook.
# This is the run whose whole purpose is to fetch upstream and notice that it moved.
- name: Run codegen step
shell: bash
run: |
set -Eeuo pipefail
dotnet run --project ./LanguageTagsCreate/LanguageTagsCreate.csproj -- \
--codepath .
44 changes: 44 additions & 0 deletions .github/actions/validate/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# This repository's validate hook, run by the hub's validate-task.yml validate job.
# The hub task already covers the fleet doc-lint block, the language lint, and the unit tests, so this hook carries only the domain check those cannot express.
name: Validate repository (LanguageTags)
description: Deterministic offline codegen drift guard over the committed language data and its generated C#.

runs:
using: composite
steps:

- name: Setup .NET SDK step
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: 10.x

# --skip-download regenerates from the committed LanguageData/ rather than from upstream, so this check never reaches the network.
# That is what makes it deterministic: registry drift can never trip it, and refreshing from upstream stays the scheduled codegen workflow's job.
- name: Regenerate codegen offline step
shell: bash
run: |
set -Eeuo pipefail
dotnet run --project ./LanguageTagsCreate/LanguageTagsCreate.csproj -- \
--codepath . --skip-download

# The same formatter the codegen workflow runs, so formatting alone can never read as drift.
- name: Format code step
shell: bash
run: |
set -Eeuo pipefail
dotnet tool restore
dotnet csharpier format .

- name: Check for drift step
shell: bash
run: |
set -Eeuo pipefail
# Fail on any drift, whether a modified tracked file or a new untracked generated one.
# Report a porcelain summary plus a diffstat rather than the full patch.
# A generated data file's patch can run to megabytes and would bury the rest of the log.
if [ -n "$(git status --porcelain --untracked-files=all)" ]; then
echo "::error::Generated code or formatting drifted. Regenerate offline with --skip-download, run 'dotnet csharpier format .', and commit the result."
git status --porcelain --untracked-files=all
git diff --stat
exit 1
fi
238 changes: 0 additions & 238 deletions .github/workflows/build-release-task.yml

This file was deleted.

Loading