Skip to content

[net11.0] Merge main into net11.0. #22766

[net11.0] Merge main into net11.0.

[net11.0] Merge main into net11.0. #22766

name: Bump global.json for dotnet/sdk bumps
on:
pull_request:
types: [opened, synchronize]
permissions: {}
jobs:
bump-global-json:
name: Bump global.json
runs-on: ubuntu-latest
# GITHUB_TOKEN change from read-write to read-only on 2024-02-01 requires permissions block
# https://docs.opensource.microsoft.com/github/apps/permission-changes/
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs
permissions:
contents: write
# We'll never need to run this workflow for PRs from forks, so explicitly avoid that to limit potential exposure
if: github.event.pull_request.head.repo.full_name == github.repository &&
github.event.pull_request.user.login == 'dotnet-maestro[bot]' &&
contains(github.event.pull_request.title, 'Update dependencies from dotnet/')
steps:
- name: 'Checkout repo'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
persist-credentials: true # we need the credentials to push code
- name: 'Update global.json'
env:
PR_NUMBER: ${{ github.event.number }}
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
set -exo pipefail
touch Make.config.inc # create a dummy file to avoid logic we don't need executed here
make global.json
if git diff --exit-code -- global.json; then
echo "No global.json update necessary"
exit 0
fi
git add -- global.json
git config --global user.email "github-actions@xamarin.com"
git config --global user.name "GitHub Actions"
git commit -m "Re-generate global.json for PR #$PR_NUMBER: $PR_TITLE"
git push