Skip to content

Add pluggable serialization strategy and make BinaryFormatter opt-in #1271

Add pluggable serialization strategy and make BinaryFormatter opt-in

Add pluggable serialization strategy and make BinaryFormatter opt-in #1271

name: Generate Async code
on:
pull_request_target:
paths:
- '**.cs'
permissions:
contents: read
jobs:
generate-async:
runs-on: ubuntu-latest
outputs:
has_changes: ${{ steps.check_changes.outputs.has_changes }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
persist-credentials: false
- name: Setup .NET
uses: actions/setup-dotnet@v5
with:
global-json-file: global.json
- name: Generate Async code
run: |
pushd src
dotnet tool restore
dotnet restore ./NHibernate.sln
dotnet async-generator
popd
- name: Check for changes
id: check_changes
run: |
git add -A
if git diff --cached --quiet -- '*.cs'; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
git diff --cached -- '*.cs' > changes.patch
fi
- name: Upload patch
if: steps.check_changes.outputs.has_changes == 'true'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: async-changes
path: changes.patch
retention-days: 1
commit-changes:
needs: generate-async
if: needs.generate-async.outputs.has_changes == 'true'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Download patch
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: async-changes
- name: Apply patch
run: git apply changes.patch
- name: Commit and push
uses: stefanzweifel/git-auto-commit-action@v7
with:
commit_message: "Generate async files"
file_pattern: "**/*.cs"