Skip to content

Commit

Permalink
CLOUDP-231603: Fix updating dependabot licenses
Browse files Browse the repository at this point in the history
Signed-off-by: jose.vazquez <jose.vazquez@mongodb.com>
  • Loading branch information
josvazg committed Feb 29, 2024
1 parent 7f38fa5 commit 29eb518
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ jobs:
uses: ./.github/workflows/test-unit.yml

check-licenses:
# Dependabot changes do not update licenses, so will never pass this check
if: github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]'
uses: ./.github/workflows/check-licenses.yml

cloud-tests-filter:
Expand Down
29 changes: 21 additions & 8 deletions .github/workflows/update-licenses.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Update dependabot PR Licenses
on:
workflow_dispatch:
inputs:
branch:
description: "Branch to patch"
required: true
push:
branches:
- dependabot/go_modules/**
Expand All @@ -12,22 +16,31 @@ jobs:
run:
name: Recompute licenses & update PR
runs-on: ubuntu-latest
env:
BRANCH: ${{ inputs.branch || github.ref_name }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ env.BRANCH }}

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: "${{ github.workspace }}/go.mod"
cache: false

- name: recompute licenses
- name: Recompute licenses
run: make recompute-licenses

- uses: stefanzweifel/git-auto-commit-action@v4.1.1
with:
commit_message: |
Updated dependency licenses
dependabot skip
branch: ${{ github.head_ref }}
- name: Commit as needed
run: |
if [[ $(git diff --stat) != '' ]]; then
echo 'Committing changes'
git config user.email "akobot@ako-team-fake.mongodb.com"
git config user.name "AKOBot"
git add .
git commit -m "Fix licenses after dependabot changes" -m "[dependabot skip]"
git push
else
echo 'Clean nothing to do'
fi

0 comments on commit 29eb518

Please sign in to comment.