Skip to content

Commit

Permalink
update all golang dependencies weekly
Browse files Browse the repository at this point in the history
  • Loading branch information
silvestre committed Jan 29, 2024
1 parent a50b099 commit 0097746
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 1 deletion.
41 changes: 41 additions & 0 deletions .github/workflows/update-all-golang-dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "update all golang dependencies"
on:
schedule: # Monday morning: https://crontab.guru/#0_6_*_*_1
- cron: "0 6 * * 1"
workflow_dispatch: {}
jobs:
make-go-get-u:
name: "go get -u"
runs-on: ubuntu-latest
container:
image: ghcr.io/cloudfoundry/app-autoscaler-release-tools:main
permissions:
pull-requests: write
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: make go-get-u and make package-specs
shell: bash
run: |
#! /usr/bin/env bash
set -eu -o pipefail
git config --global --add safe.directory "${GITHUB_WORKSPACE}"
git switch --force-create scheduled-dependency-update-with-go-get-u origin/main
make go-get-u package-specs
declare -i -r num_changed_files="$(git status --porcelain | wc --lines)"
if ((num_changed_files > 0))
then
echo 'Changes to some files were necessary!'
git add .
git commit --message="Automated dependency update with go get -u" --message="Please check that no unwanted changes have been introduced."
git push
gh pr create --fill --label dependencies
else
echo 'No files changed!'
fi
echo '🏁'
11 changes: 10 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ go-changelog-dir := ./src/changelog
go-changeloglockcleander-dir := ./src/changeloglockcleaner
go-test-app-dir := ./src/acceptance/assets/app/go_app

go_modules := $(shell find . -maxdepth 3 -name "*.mod" -exec dirname {} \; | sed 's|\./src/||' | sort)
go_modules := $(shell find . -maxdepth 6 -name "*.mod" -exec dirname {} \; | sed 's|\./src/||' | sort)
all_modules := $(go_modules) db scheduler

MVN_OPTS = "-Dmaven.test.skip=true"
Expand Down Expand Up @@ -436,3 +436,12 @@ validate-openapi-specs: $(wildcard ./api/*.openapi.yaml)
for file in $^ ; do \
swagger-cli validate "$${file}" ; \
done

.PHONY: go-get-u
go-get-u: $(addsuffix .go-get-u,$(go_modules))

.PHONY: %.go-get-u
%.go-get-u: % generate-fakes
@echo " - go get -u" $<
cd src/$< && \
go get -u ./...

0 comments on commit 0097746

Please sign in to comment.