Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
feat: implement locale-specific build workflow
  • Loading branch information
thomhurst committed Sep 24, 2025
commit a8c830e315b7d23ee28826d4f2f4e204b8059d92
52 changes: 52 additions & 0 deletions .github/workflows/dotnet-build-different-locale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: .NET

on:
pull_request:
branches: ["main"]

jobs:
modularpipeline:
strategy:
matrix:
locale: [fr-FR, pl-PL, de-DE]
fail-fast: true
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Setup .NET 8
uses: actions/setup-dotnet@v5
with:
dotnet-version: 8.0.x

- name: Setup .NET 9
uses: actions/setup-dotnet@v5
with:
dotnet-version: 9.0.x

- name: Setup .NET 10
uses: actions/setup-dotnet@v5
with:
dotnet-version: 10.0.x

- name: Generate and set locale for subsequent steps
run: |
# Convert hyphen (fr-FR) to underscore (fr_FR) which is the correct locale name on Ubuntu
LOCALE=${{ matrix.locale }}
LOCALE=${LOCALE/-/_}

sudo apt-get update
sudo apt-get install -y locales
sudo locale-gen "${LOCALE}.UTF-8"
sudo update-locale LANG="${LOCALE}.UTF-8"

# Export for subsequent GitHub Actions steps
echo "LANG=${LOCALE}.UTF-8" >> $GITHUB_ENV
echo "LC_ALL=${LOCALE}.UTF-8" >> $GITHUB_ENV

- name: Build
run: dotnet build -c Release
working-directory: TUnit.TestProject
Comment on lines +9 to +52

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 3 months ago

To fix the problem and follow least-privilege guidelines, explicitly set the minimal permissions for the workflow or the modularpipeline job. Since there is only one job, and it does not need write permissions, setting

permissions:
  contents: read

either at the workflow root (applies to all jobs), or within the job (applies just to that job) will resolve the issue and satisfy CodeQL. For clarity and maintainability, put this at the root, after name: .NET, so it applies globally and is easily discoverable by future maintainers. No other changes required.

Suggested changeset 1
.github/workflows/dotnet-build-different-locale.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/dotnet-build-different-locale.yml b/.github/workflows/dotnet-build-different-locale.yml
--- a/.github/workflows/dotnet-build-different-locale.yml
+++ b/.github/workflows/dotnet-build-different-locale.yml
@@ -1,4 +1,6 @@
 name: .NET
+permissions:
+  contents: read
 
 on:
   pull_request:
EOF
@@ -1,4 +1,6 @@
name: .NET
permissions:
contents: read

on:
pull_request:
Copilot is powered by AI and may make mistakes. Always verify output.
11 changes: 10 additions & 1 deletion TUnit.TestProject/DecimalArgumentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
}

[Test]
[Arguments("123.456")] // Decimal value as string

Check failure on line 58 in TUnit.TestProject/DecimalArgumentTests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (fr-FR)

Attribute argument types 'string' don't match method parameter types 'decimal'

Check failure on line 58 in TUnit.TestProject/DecimalArgumentTests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (fr-FR)

Attribute argument types 'string' don't match method parameter types 'decimal'

Check failure on line 58 in TUnit.TestProject/DecimalArgumentTests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (fr-FR)

Attribute argument types 'string' don't match method parameter types 'decimal'

Check failure on line 58 in TUnit.TestProject/DecimalArgumentTests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (fr-FR)

Attribute argument types 'string' don't match method parameter types 'decimal'

Check failure on line 58 in TUnit.TestProject/DecimalArgumentTests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (fr-FR)

Attribute argument types 'string' don't match method parameter types 'decimal'

Check failure on line 58 in TUnit.TestProject/DecimalArgumentTests.cs

View workflow job for this annotation

GitHub Actions / modularpipeline (fr-FR)

Attribute argument types 'string' don't match method parameter types 'decimal'
public async Task ExplicitDecimalValue(decimal value)
{
await Assert.That(value).IsEqualTo(123.456m);
Expand All @@ -76,6 +76,15 @@
[Arguments(1)]
public void Test(decimal test)
{
return;
}


[Test]
[Arguments(50, 75, 70, 5, 0, true)]
[Arguments(70, 75, 70, 5, 5, true)]
[Arguments(70, 75, 70, 5, 0, false)]
public void TransactionDiscountCalculations(decimal amountPaying, decimal invoiceBalance,
decimal invoiceBalanceDue, decimal discountAmount, decimal appliedDiscountAmount, bool discountAllowedForUser)
{
}
}
Loading