-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (63 loc) · 2.34 KB
/
dotnet-outdated.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Outdated libraries
on:
workflow_dispatch:
schedule:
- cron: "0 6 * * 1" #6am every monday
jobs:
outdated:
name: update outdated packages
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
- name: setup dotnet
uses: actions/setup-dotnet@v1
- name: install dotnet-outdated
run: |
dotnet tool install --global dotnet-outdated-tool
dotnet tool update --global dotnet-outdated-tool
- name: checkout new branch
id: checkout
run: |
if git ls-remote --exit-code --heads origin dotnet-outdated ; then
git fetch
git checkout dotnet-outdated
git pull
echo "::set-output name=new_branch::no"
else
git checkout -b dotnet-outdated
echo "::set-outuput name=new_branch::yes"
fi
- name: run dotNet restore
run: dotnet restore Biplov.EventBus.RabbitMQ.sln
- name: run dotnet outdated
id: outdated
run: |
if dotnet outdated -u -f -vl major -exc BenchmarkDotNet -exc xunit.runner.visualstudio -exec Moq; then
echo "::set-output name=has_changes::no"
else
echo "::set_output name=has_changes::yes"
fi
- name: commit and push changes
run: |
if [ "${{ steps.outdated.outputs.has_changes }}" = "no" ] ; then
echo "No updates today"
else
git config --local user.email "action@github.com"
git config --local user.name "Github Action"
git add .
git commit -m 'dotnet-outdated updates - minor and patch'
git push --set-upstream origin dotnet-outdated
fi
- name: create pr
run: |
if [ "${{ steps.outdated.outputs.has_changes }}" = "no" ]; then
echo "No updates today"
else
if [ "${{ steps.checkout.outputs.new_branch }}" = "yes" ]; then
curl --request POST \
--url https://api.github.com/repos/${{ github.repository }}/pulls \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--data '{ "title": "dotnet-outdated updates", "body": "Minor and Patch package updates", "head": "dotnet-outdated", "base": "main"}'
fi
fi