Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f2e9e01
chore(workflows): added permissions to release-1-milestone
marc-romu May 6, 2025
51a7d40
chore(workflows): minor fixes
marc-romu May 6, 2025
fc3bd35
chore(workflows): do not fix file headers by default
marc-romu May 6, 2025
08b3e60
chore(workflows): added soft-check mode
marc-romu May 6, 2025
1dea815
chore(workflows): removed fix code on release
marc-romu May 6, 2025
6e0b147
chore: minor fixes
marc-romu May 6, 2025
eed086b
chore(workflow): move pr to init
marc-romu May 6, 2025
fe1d141
chore
marc-romu May 6, 2025
19f83ef
chore
marc-romu May 6, 2025
0ec4b1e
chore
marc-romu May 6, 2025
16fb20f
chore
marc-romu May 6, 2025
486a307
chore(workflow): update pr creation
marc-romu May 6, 2025
9141dd5
chore: minor fixes
marc-romu May 6, 2025
b448a44
chore: fix milestone number
marc-romu May 6, 2025
5b161bb
chore: delete existing release branch if exists
marc-romu May 6, 2025
a8853fa
chore: remove remote branch if exists
marc-romu May 6, 2025
980b3df
chore: correct milestone id
marc-romu May 6, 2025
d3345db
chore: remove milestone
marc-romu May 6, 2025
263f4c7
chore(workflow): create direct pr from dev to main with no commit
marc-romu May 7, 2025
d964303
chore(workflow): add manual trigger
marc-romu May 7, 2025
39451cb
chore: spelling mistake
marc-romu May 7, 2025
784a523
chore(workflow): setup manual inputs on manual trigger
marc-romu May 7, 2025
5cf8ce1
chore(workflow): incorrect permissions
marc-romu May 7, 2025
bd0f377
chore: prepare release 0.3.1-alpha with version update and code style…
marc-romu May 7, 2025
8fa38f9
chore: minor fixes
marc-romu May 7, 2025
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
20 changes: 13 additions & 7 deletions .github/actions/code-style/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,18 @@ inputs:
runs:
using: "composite"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for existing .NET SDK
Copy link

Copilot AI May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This .NET SDK version check is repeated across several code style actions; refactoring it into a centralized reusable action could improve maintainability and consistency.

Copilot uses AI. Check for mistakes.
id: check-dotnet
shell: bash
run: |
if dotnet --version >/dev/null 2>&1; then
echo "installed=true" >> $GITHUB_OUTPUT
else
echo "installed=false" >> $GITHUB_OUTPUT
fi
- name: Setup .NET
uses: actions/setup-dotnet@v3
if: ${{ steps.check-dotnet.outputs.installed == 'false' }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.0.x'
- name: Run dotnet-format
Expand All @@ -34,7 +40,7 @@ runs:
- name: Process C# file headers
uses: ./.github/actions/code-style/header-fixer
with:
mode: ${{ inputs.mode }}
mode: soft-check
- name: Process trailing whitespace
uses: ./.github/actions/code-style/trailing-whitespace
with:
Expand All @@ -46,7 +52,7 @@ runs:
- name: Check namespaces
uses: ./.github/actions/code-style/namespace-fixer
with:
mode: check
mode: soft-check
- name: Commit & push changes
if: ${{ inputs.commit }}
shell: bash
Expand Down
19 changes: 10 additions & 9 deletions .github/actions/code-style/header-fixer/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@ name: "Header Fixer"
description: "Check or fix C# file headers to match .editorconfig header template"
inputs:
mode:
description: "Operation mode: fix or check"
description: "Operation mode: fix, check, or soft-check"
required: false
default: "check"
default: "soft-check"
runs:
using: "composite"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Process C# file headers
shell: bash
env:
Expand Down Expand Up @@ -45,7 +41,7 @@ runs:
HEADER_LINES=$(echo -e "$HEADER" | wc -l)
CURRENT_HEADER=$(head -n $HEADER_LINES "$file")

if [ "$(echo -e "$HEADER")" != "$CURRENT_HEADER" ]; then
if [ "$HEADER" != "$CURRENT_HEADER" ]; then
if [ "${{ inputs.mode }}" = "fix" ]; then
echo "Updating header in $file"
# Find namespace line
Expand All @@ -59,8 +55,13 @@ runs:
echo "Warning: Could not find namespace line in $file"
fi
else
echo "Header mismatch in $file"
ERR=1
if [ "${{ inputs.mode }}" = "soft-check" ]; then
# emit a non-blocking warning
echo "::warning file=$file::Header mismatch in $file (run with mode=fix to auto-fix)"
else
echo "Header mismatch in $file"
ERR=1
fi
fi
fi
fi
Expand Down
15 changes: 8 additions & 7 deletions .github/actions/code-style/namespace-fixer/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@ name: "Namespace Fixer"
description: "Check or fix C# file namespaces to match file path"
inputs:
mode:
description: "Operation mode: fix or check"
description: "Operation mode: fix, check, or soft-check"
required: false
default: "check"
runs:
using: "composite"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Process C# namespaces
if: always()
shell: bash
Expand All @@ -38,8 +34,13 @@ runs:
sed -i "s/^namespace .*/namespace $ns/" "$file"
echo "WARNING: References to this file may need manual updates."
else
echo "Namespace mismatch in $file: expected $ns but found $actual"
ERR=1
if [ "${{ inputs.mode }}" = "soft-check" ]; then
# emit a non-blocking warning
echo "::warning file=$file::Namespace mismatch in $file (run with mode=fix to auto-fix)"
else
echo "Namespace mismatch in $file: expected $ns but found $actual"
ERR=1
fi
fi
fi
fi
Expand Down
15 changes: 8 additions & 7 deletions .github/actions/code-style/trailing-whitespace/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,12 @@ name: "Trailing Whitespace"
description: "Check or fix trailing whitespace and normalize line endings"
inputs:
mode:
description: "Operation mode: fix or check"
description: "Operation mode: fix, check, or soft-check"
required: false
default: "check"
runs:
using: "composite"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Process trailing whitespace
shell: bash
run: |
Expand All @@ -25,8 +21,13 @@ runs:
sed -i 's/\r$//' "$file"
else
if grep -qE '[ \t]+$' "$file" || file "$file" | grep -q CRLF; then
echo "Trailing whitespace or CRLF found in $file"
ERR=1
if [ "${{ inputs.mode }}" = "soft-check" ]; then
# emit a non-blocking warning
echo "::warning file=$file::Trailing whitespace or CRLF found in $file (run with mode=fix to auto-fix)"
else
echo "Trailing whitespace or CRLF found in $file"
ERR=1
fi
fi
fi
fi
Expand Down
20 changes: 13 additions & 7 deletions .github/actions/code-style/using-sorter/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,24 @@ name: "Using Sorter"
description: "Check or fix C# using directives ordering and remove unused usings"
inputs:
mode:
description: "Operation mode: fix or check"
description: "Operation mode: fix, check, or soft-check"
required: false
default: "check"
runs:
using: "composite"
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for existing .NET SDK
id: check-dotnet
shell: bash
run: |
if dotnet --version >/dev/null 2>&1; then
echo "installed=true" >> $GITHUB_OUTPUT
else
echo "installed=false" >> $GITHUB_OUTPUT
fi
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
if: ${{ steps.check-dotnet.outputs.installed == 'false' }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: 7.0.x
- name: Run using sorter
Expand All @@ -25,7 +31,7 @@ runs:
export PATH="$HOME/.dotnet/tools:$PATH"
for file in $FILES; do
if [ -f "$file" ]; then
if [ "${{ inputs.mode }}" = "check" ]; then
if [ "${{ inputs.mode }}" = "check" ] || [ "${{ inputs.mode }}" = "soft-check" ]; then
dotnet format "$file" --verify-no-changes --fix-analyzers
else
dotnet format "$file" --fix-analyzers
Expand Down
13 changes: 12 additions & 1 deletion .github/workflows/ci-dotnet-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,19 @@ jobs:
- name: Checkout code
uses: actions/checkout@v3

- name: Check for existing .NET SDK
id: check-dotnet
shell: bash
run: |
if dotnet --version >/dev/null 2>&1; then
echo "installed=true" >> $GITHUB_OUTPUT
else
echo "installed=false" >> $GITHUB_OUTPUT
fi

- name: Setup .NET
uses: actions/setup-dotnet@v3
if: ${{ steps.check-dotnet.outputs.installed == 'false' }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.0.x'

Expand Down
62 changes: 46 additions & 16 deletions .github/workflows/release-1-milestone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ name: 🏁 1 Prepare Release on Milestone Close
# Permissions:
# - contents:write - Required to create GitHub releases
# - issues:read - Required to read issue information for release notes
# - pull-requests:read - Required to read PR information for release notes
# - pull-requests:write - Required to create pull requests
#
permissions:
contents: write
issues: read
pull-requests: write

on:
workflow_dispatch:
milestone:
types: [ closed ]

Expand All @@ -25,42 +29,68 @@ jobs:
with:
fetch-depth: 0
ref: dev

- name: Set up Git user
run: |
git config user.name "github-actions"
git config user.email "action@github.com"

- name: Check if release branch exists
id: check-branch
run: |
git ls-remote --heads origin release/${{ github.event.milestone.title }}
if [ $? -eq 0 ]; then
echo "branch_exists=true" >> $GITHUB_OUTPUT
else
echo "branch_exists=false" >> $GITHUB_OUTPUT
fi

- name: Remove existing release branch if exists
if: steps.check-branch.outputs.branch_exists == 'true'
run: git push origin --delete release/${{ github.event.milestone.title }}

- name: Create release branch
run: git checkout -b release/${{ github.event.milestone.title }}

- name: Update version in Solution.props
uses: ./.github/actions/versioning/update-version
with:
new-version: ${{ github.event.milestone.title }}

- name: Include missing issues in changelog
uses: ./.github/actions/documentation/update-changelog-issues
with:
token: ${{ secrets.GITHUB_TOKEN }}
days-lookback: 90

- name: Update changelog section
uses: ./.github/actions/documentation/update-changelog
with:
action: create-release
version: ${{ github.event.milestone.title }}
- name: Fix code style
uses: ./.github/actions/code-style
with:
mode: fix
commit: false

- name: Update README badges
uses: ./.github/actions/documentation/update-badges
id: update-badges

# - name: Fix code style
# uses: ./.github/actions/code-style
# with:
# mode: fix
# commit: false

- name: Commit and push changes
run: |
git add Solution.props CHANGELOG.md
git add Solution.props CHANGELOG.md README.md
git commit -m "chore: prepare release ${{ github.event.milestone.title }} with version update and code style fixes"
git push origin release/${{ github.event.milestone.title }}

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "chore: prepare release ${{ github.event.milestone.title }} with version update and code style fixes"
body: "This PR prepares the release for version ${{ github.event.milestone.title }} with version update and code style fixes:\n\n- Fixed header code style\n- Sorted usings\n- Removed trailing whitespace\n- Updated version in Solution.props\n- Updated changelog with closed-solved issues\n\nMILESTONE DESCRIPTION:\n${{ github.event.milestone.description }}"
base: dev
branch: release/${{ github.event.milestone.title }}
milestone: ${{ github.event.milestone.number }}
run: |
gh pr create \
--base dev \
--head release/${{ github.event.milestone.title }} \
--title "chore: prepare release ${{ github.event.milestone.title }} with version update and code style fixes" \
--body $'This PR prepares the release for version ${{ github.event.milestone.title }} with version update and code style fixes:\n\n- Fixed header code style\n- Sorted usings\n- Removed trailing whitespace\n- Updated version in Solution.props\n- Updated changelog with closed-solved issues\n- Updated README badges\n\nMILESTONE DESCRIPTION:\n${{ github.event.milestone.description }}'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52 changes: 33 additions & 19 deletions .github/workflows/release-2-pr-to-dev-closed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,51 @@ name: 🏁 2 PR Release to Main from Dev
# Permissions:
# - contents:write - Required to create GitHub releases
# - issues:read - Required to read issue information for release notes
# - pull-requests:read - Required to read PR information for release notes
# - pull-requests:write - Required to create PRs

on:
workflow_dispatch:
pull_request:
types: [ closed ]
branches:
- dev
workflow_dispatch:
inputs:
pr-title:
required: true
type: string
pr-body:
required: true
type: string

jobs:
create-pr-dev-to-main:
if: ${{ github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/') }}
if: ${{ ( github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')) || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
permissions:
contents: write
issues: read
pull-requests: read
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: dev
- name: Set up Git user
- name: Create PR (on PR closed)
if: ${{ github.event_name == 'pull_request' }}
run: |
gh pr create \
--repo ${{ github.repository }} \
--base main \
--head dev \
--title "${{ github.event.pull_request.head.ref }}" \
--body "${{ github.event.pull_request.body }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create PR (manual dispatch)
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
git config user.name "github-actions"
git config user.email "action@github.com"
- name: Create PR
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "${{ github.event.pull_request.head.ref }}"
body: "${{ github.event.pull_request.body }}"
base: main
branch: ${{ github.event.pull_request.base.ref }}
gh pr create \
--repo ${{ github.repository }} \
--base main \
--head dev \
--title "${{ github.event.inputs['pr-title'] }}" \
--body "${{ github.event.inputs['pr-body'] }}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading
Loading