Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 35035ce

Browse files
authored
ci: add an action to update lock file (#81)
* ci: add an action to update lock file
1 parent 8309800 commit 35035ce

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: '[dependabot] Update NuGet lock file'
2+
3+
on:
4+
pull_request:
5+
types: [labeled, opened, synchronize, reopened]
6+
branches: [ main ]
7+
8+
permissions:
9+
pull-requests: write
10+
contents: write
11+
12+
jobs:
13+
update-lock-file:
14+
runs-on: ubuntu-latest
15+
16+
if: ${{ (github.actor == 'dependabot[bot]' && github.event.action != 'labeled') || (github.event.action == 'labeled' && github.event.label.name == 'ci:update-lockfile') }}
17+
steps:
18+
- name: Dependabot metadata
19+
if: ${{ github.actor == 'dependabot[bot]' }}
20+
id: metadata
21+
uses: dependabot/[email protected]
22+
with:
23+
github-token: "${{ secrets.GITHUB_TOKEN }}"
24+
- uses: actions/checkout@v4
25+
if: ${{ github.actor == 'dependabot[bot]' && steps.metadata.outputs.package-ecosystem == 'nuget' || github.event.action == 'labeled' }}
26+
with:
27+
ref: ${{ github.head_ref }}
28+
- name: Setup .NET
29+
if: ${{ github.actor == 'dependabot[bot]' && steps.metadata.outputs.package-ecosystem == 'nuget' || github.event.action == 'labeled' }}
30+
uses: actions/setup-dotnet@v4
31+
with:
32+
dotnet-version: 8.0.x
33+
- name: Restore dependencies
34+
if: ${{ github.actor == 'dependabot[bot]' && steps.metadata.outputs.package-ecosystem == 'nuget' || github.event.action == 'labeled' }}
35+
run: dotnet restore
36+
- uses: stefanzweifel/git-auto-commit-action@v5
37+
with:
38+
commit_message: "chore: update NugGet lock file"
39+
file_pattern: '*/packages.lock.json'
40+
- name: Remove PR trigger label
41+
if: ${{ github.event.action == 'labeled'}}
42+
env:
43+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
uses: actions/github-script@v7
45+
with:
46+
script: |
47+
try {
48+
await github.rest.issues.removeLabel({
49+
owner: '${{github.repository_owner}}',
50+
repo: '${{github.event.repository.name}}',
51+
issue_number: ${{github.event.pull_request.number}},
52+
name: '${{github.event.label.name}}'
53+
});
54+
} catch(e){}

0 commit comments

Comments
 (0)