Skip to content

Commit 37c220f

Browse files
committed
Add update-dotnet-install-script workflow
1 parent 5b71121 commit 37c220f

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: "Update dotnet-install script"
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '0 0 * * 0' # Runs every Sunday at midnight UTC (adjust as needed)
6+
7+
jobs:
8+
fetch-latest-dotnet-install:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v3
12+
13+
- name: Run fetch-latest-dotnet-install.sh
14+
run: src/dotnet/scripts/fetch-latest-dotnet-install.sh
15+
16+
- name: Create a PR for dotnet-install.sh
17+
id: push_image_info
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
run: |
21+
set -e
22+
echo "Start."
23+
24+
# Configure git and Push updates
25+
git config --global user.email github-actions@github.com
26+
git config --global user.name github-actions
27+
git config pull.rebase false
28+
29+
branch=automated-script-update-$GITHUB_RUN_ID
30+
git checkout -b $branch
31+
message='Automated dotnet-install script update'
32+
33+
# Add / update and commit
34+
git add src/dotnet/scripts/vendor/dotnet-install.sh
35+
git commit -m 'Automated dotnet-install script update [skip ci]' || export NO_UPDATES=true
36+
37+
# Push
38+
if [ "$NO_UPDATES" != "true" ] ; then
39+
git push origin "$branch"
40+
gh api \
41+
--method POST \
42+
-H "Accept: application/vnd.github+json" \
43+
/repos/${GITHUB_REPOSITORY}/pulls \
44+
-f title="$message" \
45+
-f body="$message" \
46+
-f head="$branch" \
47+
-f base="$GITHUB_REF_NAME"
48+
fi

0 commit comments

Comments
 (0)