-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add post dependabot action to update notice file #3351
Merged
michel-laterman
merged 4 commits into
elastic:main
from
michel-laterman:post-dependabot-action
Mar 13, 2024
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
08b5469
Add post dependabot action to update notice file
michel-laterman c86a013
Run go mod tidy in testing and commit changes if needed
michel-laterman 817e8f2
Merge branch 'main' into post-dependabot-action
michel-laterman 6c78446
Merge branch 'main' into post-dependabot-action
michel-laterman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# Follow-on actions relating to dependabot PRs. In elastic/fleet-server, any changes to | ||
# dependencies contained in go.mod requires the change to be reflected in the | ||
# NOTICE.txt file. When dependabot creates a branch for a go_modules change this | ||
# will update the NOTICE.txt file for that change. | ||
name: post-dependabot | ||
|
||
on: | ||
push: | ||
branches: | ||
- 'dependabot/go_modules/**' | ||
|
||
jobs: | ||
update-notice: | ||
permissions: | ||
# Allow job to write to the branch. | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: .go-version | ||
|
||
- name: run go mod tidy in testing/ | ||
run: cd testing; go mod tidy | ||
|
||
- name: check for modified testing/go.mod or testing/go.sum | ||
id: testing-mod-check | ||
run: echo "modified=$(if git diff-index --quite HEAD -- testing/go.mod testing/go.sum; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT | ||
|
||
- name: commit testing/go.mod and testing/go.sum files | ||
if: steps.testing-mod-check.outputs.modified == 'true' | ||
run: | | ||
git config --global user.name 'dependabot[bot]' | ||
git config --global user.email 'dependabot[bot]@users.noreply.github.com' | ||
git add testing/go.mod testing/go.sum | ||
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | ||
git commit -m "Update testing/go.mod and testing/go.sum files" | ||
git push | ||
|
||
- name: update NOTICE.txt | ||
run: make notice | ||
|
||
- name: check for modified NOTICE.txt | ||
id: notice-check | ||
run: echo "modified=$(if git diff-index --quiet HEAD -- NOTICE.txt; then echo "false"; else echo "true"; fi)" >> $GITHUB_OUTPUT | ||
|
||
- name: commit NOTICE.txt | ||
if: steps.notice-check.outputs.modified == 'true' | ||
run: | | ||
git config --global user.name 'dependabot[bot]' | ||
git config --global user.email 'dependabot[bot]@users.noreply.github.com' | ||
git add NOTICE.txt | ||
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to do anything to setup There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so. Agent repo has the same setup as the fleet-server one. |
||
git commit -m "Update NOTICE.txt" | ||
git push |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jlind23, I've added some additional steps to the action to update the
testing/go.mod
andtesting/go.sum
files if needed; it should fix failures where the updated dependencies are used by the testing libs such as #3347