-
Notifications
You must be signed in to change notification settings - Fork 2.4k
54 lines (50 loc) · 1.7 KB
/
update-packages.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: Update NuGet packages
on:
workflow_dispatch:
schedule:
# Every Sunday at 8am
- cron: '0 8 * * Sun'
push:
branches:
- 'sebros/outdated'
permissions:
issues: write
pull-requests: write
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
main:
runs-on: ubuntu-latest
name: Check Versions and Create PR
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Run dotnet outdated
id: dotnet_outdated
run: |
mkdir ${{ runner.temp }}/build_logs
dotnet tool install --global dotnet-outdated-tool
exec 5>&1
OUTPUT=$(dotnet-outdated --version-lock major --output-format markdown --no-restore --output ${{ runner.temp }}/build_logs/dotnet-updated.md --upgrade --exclude "Microsoft.AspNetCore" --exclude "Microsoft.Extensions.Caching.StackExchangeRedis"|tee /dev/fd/5)
if [[ $OUTPUT =~ "No outdated dependencies were detected" ]]; then
echo "{updated}={false}" >> $GITHUB_OUTPUT
else
echo "{updated}={true}" >> $GITHUB_OUTPUT
fi
echo $OUTPUT
shell: bash
- name: Create pull request
if: steps.dotnet_outdated.outputs.updated == 'true'
run: |
git config user.name "github-actions"
git config user.email "[email protected]"
git checkout -b gh/outdated
git pull
git commit -am "Update NuGet packages"
git push origin HEAD
gh pr create --base main --head gh/outdated --title 'Update NuGet packages' --body-file ${{ runner.temp }}/build_logs/dotnet-updated.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}