forked from xamarin/xamarin-macios
-
Notifications
You must be signed in to change notification settings - Fork 0
39 lines (37 loc) · 1.51 KB
/
bump-global-json.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
name: Bump global.json for dotnet/installer bumps
on: pull_request_target
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
if: contains(github.event.pull_request.title, 'Update dependencies from dotnet/installer') && github.actor == 'dotnet-maestro[bot]'
steps:
- name: 'Checkout repo'
uses: actions/checkout@v4
with:
fetch-depth: 0
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.sha }}
- 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 "[email protected]"
git config --global user.name "GitHub Actions"
git checkout "$GITHUB_HEAD_REF"
git commit -m "Re-generate global.json for PR #$PR_NUMBER: $PR_TITLE"
git push