-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (41 loc) · 1.32 KB
/
dependabot-update-dotnet-lockfiles.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
name: "Automatically update dotnet lockfiles in dependabot PRs"
on:
workflow_dispatch:
pull_request_target:
env:
SOLUTION_PATH: "src/backend"
SOLUTION_NAME: "Backend.sln"
DOTNET_VERSION: "9.0.x"
jobs:
update-lockfiles:
runs-on: ubuntu-latest
if: github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- name: Checkout ${{ github.head_ref }}
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.WORKFLOW_TOKEN }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Setup git user
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- name: Update lockfiles
working-directory: ${{ env.SOLUTION_PATH }}
run: |
dotnet restore ${{ env.SOLUTION_NAME }}
git status
if output=$(git status --porcelain) && [ -z "$output" ]; then
# Working directory clean - do nothing
echo Working directory clean
exit 0
else
# Uncommitted changes
echo Add and commit changes
git commit -a -m "Update lockfiles"
git push
fi