[net11.0] Update dependencies from dotnet/dotnet #1860
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Autoformat code v2 | |
| on: pull_request | |
| permissions: {} | |
| jobs: | |
| # Job for same-repo PRs: format and push directly | |
| autoformat-push: | |
| name: Autoformat and push | |
| runs-on: ubuntu-latest | |
| if: github.event.pull_request.head.repo.full_name == github.repository | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: 'Checkout' | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| ref: ${{ github.head_ref }} | |
| fetch-depth: 1 | |
| persist-credentials: false | |
| - name: 'Install .NET' | |
| uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 | |
| with: | |
| global-json-file: ./global.json | |
| - name: 'Autoformat' | |
| run: ./tools/autoformat.sh | |
| - name: 'Check for changes' | |
| id: check | |
| run: | | |
| if git diff --quiet; then | |
| echo "changes=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changes=true" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: 'Commit and push' | |
| if: steps.check.outputs.changes == 'true' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| git config user.email 'github-actions-autoformatter@xamarin.com' | |
| git config user.name 'GitHub Actions Autoformatter' | |
| git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}" | |
| git add -A | |
| git commit -m 'Auto-format source code' | |
| git push | |
| # Job for fork PRs: format and upload patch as artifact | |
| autoformat-artifact: | |
| name: Autoformat and upload patch | |
| runs-on: ubuntu-latest | |
| if: github.event.pull_request.head.repo.full_name != github.repository | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: 'Checkout' | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| persist-credentials: false | |
| fetch-depth: 1 | |
| - name: 'Install .NET' | |
| uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 | |
| with: | |
| global-json-file: ./global.json | |
| - name: 'Autoformat' | |
| run: ./tools/autoformat.sh | |
| - name: 'Create patch' | |
| id: patch | |
| run: | | |
| if git diff --quiet; then | |
| echo "changes=false" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "changes=true" >> "$GITHUB_OUTPUT" | |
| git config user.email 'github-actions-autoformatter@xamarin.com' | |
| git config user.name 'GitHub Actions Autoformatter' | |
| git add -A | |
| git commit -m 'Auto-format source code' | |
| mkdir -p autoformat-output | |
| git format-patch HEAD~1 --stdout > autoformat-output/autoformat.patch | |
| fi | |
| - name: 'Upload patch' | |
| if: steps.patch.outputs.changes == 'true' | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: autoformat | |
| path: autoformat-output/ |