File tree Expand file tree Collapse file tree 3 files changed +41
-14
lines changed
actions/nuget-lockfile-sync Expand file tree Collapse file tree 3 files changed +41
-14
lines changed Original file line number Diff line number Diff line change 1+ name : ' NuGet Lockfile Sync'
2+ description : ' Force restore and commit updated NuGet lock files for Dependabot NuGet PRs'
3+ inputs :
4+ dotnet-version :
5+ description : ' Dotnet SDK version'
6+ required : false
7+ default : ' 9.0.304'
8+
9+ runs :
10+ using : ' composite'
11+ steps :
12+ - name : Setup .NET
13+ uses : actions/setup-dotnet@v4
14+ with :
15+ dotnet-version : ${{ inputs.dotnet-version }}
16+
17+ - name : Force restore
18+ shell : bash
19+ run : dotnet restore --force-evaluate
20+
21+ - name : Commit and Push Changes
22+ shell : bash
23+ run : |
24+ set -euo pipefail
25+ git config --global user.name 'dependabot[bot]'
26+ git config --global user.email '[email protected] ' 27+ echo '*****STARTING LOCKFILE SYNC*****'
28+ git branch --show-current
29+ git status
30+ git add -A
31+ git commit -m 'Update lock files' || echo 'No changes to commit'
32+ BRANCH_NAME="${{ github.head_ref || github.ref_name }}"
33+ echo "The branch name is $BRANCH_NAME"
34+ git push origin "$BRANCH_NAME"
Original file line number Diff line number Diff line change @@ -14,11 +14,6 @@ concurrency:
1414 cancel-in-progress : true
1515
1616jobs :
17- auto-sync :
18- name : Auto Sync Lock Files (Dependabot only)
19- if : github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' && startsWith(github.head_ref, 'dependabot/nuget/')
20- uses : ./.github/workflows/nuget-lockfile-sync.yml
21-
2217 build :
2318 name : Build
2419 runs-on : ubuntu-latest
@@ -27,11 +22,14 @@ jobs:
2722 uses : actions/checkout@v4
2823 with :
2924 ref : ${{ github.head_ref || github.ref }}
25+
3026 - name : Setup .NET
3127 uses : actions/setup-dotnet@v4
3228 with :
3329 dotnet-version : 9.0.304
30+
3431 - name : Restore dependencies
3532 run : dotnet restore --locked-mode
33+
3634 - name : Build
3735 run : dotnet build --no-restore
Original file line number Diff line number Diff line change 11name : Auto Sync Lock Files
22
33on :
4- workflow_call :
5- inputs :
6- dotnet-version :
7- description : ' Dotnet SDK version'
8- required : false
9- type : string
10- default : ' 9.0.304'
11- secrets : {}
4+ push :
5+ branches :
6+ - ' dependabot/nuget/**'
127
138permissions :
149 actions : read
3025 - name : Setup .NET
3126 uses : actions/setup-dotnet@v4
3227 with :
33- dotnet-version : ${{ inputs.dotnet-version }}
28+ dotnet-version : 9.0.304
3429
3530 - name : Force restore
3631 run : dotnet restore --force-evaluate
You can’t perform that action at this time.
0 commit comments