Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
'helpers:pinGitHubActionDigestsToSemver',
':separateMultipleMajorReleases',
],
gitIgnoredAuthors: [
"107717825+opentelemetrybot@users.noreply.github.com",
"107717825+opentelemetrybot[bot]@users.noreply.github.com",
"197425009+otelbot@users.noreply.github.com",
"197425009+otelbot[bot]@users.noreply.github.com",
"github-actions[bot]@users.noreply.github.com"
],
prHourlyLimit: 15,
prConcurrentLimit: 15,
ignorePaths: [
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/renovate-go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Renovate Post-Update Tasks / Go

on:
pull_request:
types: [opened, synchronize, edited]
paths:
- '**/go.mod'
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
gomodtidy:
# Only run on Renovate PRs
if: startsWith(github.head_ref, 'renovate/')
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-go@924ae3a1cded613372ab5595356fb5720e22ba16 # v6.5.0
with:
go-version-file: collector/go.mod
- run: find . -name "go.mod" -execdir go mod tidy \;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not 100% sure, but isn't this dangerous? When go mod tidy fails, the error would be swallowed? Or would we be able to see that failure in a later workflow that runs on the PR? (I think so, just checking to make sure...)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it should be seen in the build workflow like we are seeing atm.

- name: Check if go mod changed
id: check_changes
env:
BASE_REF: ${{ github.base_ref }}
run: |
git fetch origin "$BASE_REF"
if git diff --name-only "origin/$BASE_REF" HEAD \
| grep -E '^(.*/)?go\.(mod|sum)$' >/dev/null; then
echo "changed=true" >> $GITHUB_OUTPUT
else
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Commit and push changes
if: steps.check_changes.outputs.changed == 'true'
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add collector/

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The go sample app is not included in this, if that was intended it's fine by me though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot, i do however think sample-apps are ok as some updates are currently working. I am inclined to leave it as is given it unblocks ci & only add the additional path if we need it & we have a way to test it.

if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "chore: go mod tidy"
git push
fi
Loading