-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6ed82df
commit 06dbf04
Showing
1 changed file
with
40 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,54 @@ | ||
name: Update NuGet lock file on dependabot updates | ||
name: '[dependabot] Update NuGet lock file' | ||
|
||
on: | ||
pull_request: | ||
types: [labeled, opened, synchronize, reopened] | ||
branches: [ main ] | ||
issue_comment: | ||
types: [created] | ||
|
||
permissions: | ||
pull-requests: write | ||
contents: write | ||
|
||
jobs: | ||
update-lock-file: | ||
runs-on: ubuntu-latest | ||
|
||
if: ${{ github.actor == 'dependabot[bot]' || (github.event.pull_request && github.event.label == 'ci:update-lockfile') || (github.event.issue.pull_request && github.event.comment == 'ci:update-lockfile') }} | ||
if: ${{ github.actor == 'dependabot[bot]' || (github.event.action == 'labeled' && github.event.label.name == 'ci:update-lockfile') }} | ||
steps: | ||
- name: Dependabot metadata | ||
id: metadata | ||
uses: dependabot/[email protected] | ||
with: | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
- uses: actions/checkout@v4 | ||
if: ${{steps.metadata.outputs.package-ecosystem == 'nuget'}} | ||
with: | ||
ref: ${{ github.head_ref }} | ||
- name: Setup .NET | ||
if: ${{steps.metadata.outputs.package-ecosystem == 'nuget'}} | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
- name: Restore dependencies | ||
if: ${{steps.metadata.outputs.package-ecosystem == 'nuget'}} | ||
run: dotnet restore | ||
- uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: "chore: update NugGet lock file" | ||
file_pattern: src/packages.lock.json | ||
|
||
- name: Dependabot metadata | ||
if: ${{ github.actor == 'dependabot[bot]' }} | ||
id: metadata | ||
uses: dependabot/[email protected] | ||
with: | ||
github-token: "${{ secrets.GITHUB_TOKEN }}" | ||
- uses: actions/checkout@v4 | ||
if: ${{ github.actor == 'dependabot[bot]' && steps.metadata.outputs.package-ecosystem == 'nuget' || github.event.action == 'labeled' }} | ||
with: | ||
ref: ${{ github.head_ref }} | ||
- name: Setup .NET | ||
if: ${{ github.actor == 'dependabot[bot]' && steps.metadata.outputs.package-ecosystem == 'nuget' || github.event.action == 'labeled' }} | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
- name: Restore dependencies | ||
if: ${{ github.actor == 'dependabot[bot]' && steps.metadata.outputs.package-ecosystem == 'nuget' || github.event.action == 'labeled' }} | ||
run: dotnet restore | ||
- uses: stefanzweifel/git-auto-commit-action@v5 | ||
with: | ||
commit_message: "chore: update NugGet lock file" | ||
file_pattern: '*/packages.lock.json' | ||
- name: Remove PR trigger label | ||
if: ${{ github.event.action == 'labeled'}} | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
try { | ||
await github.rest.issues.removeLabel({ | ||
owner: '${{github.repository_owner}}', | ||
repo: '${{github.event.repository.name}}', | ||
issue_number: ${{github.event.pull_request.number}}, | ||
name: '${{github.event.label.name}}' | ||
}); | ||
} catch(e){} |