From dbbb33925c490af495c198b903812f69059d540b Mon Sep 17 00:00:00 2001 From: civisrom <167646351+civisrom@users.noreply.github.com> Date: Tue, 4 Feb 2025 21:03:25 +0300 Subject: [PATCH] Create update-dependencies.yml --- .github/workflows/update-dependencies.yml | 43 +++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/update-dependencies.yml diff --git a/.github/workflows/update-dependencies.yml b/.github/workflows/update-dependencies.yml new file mode 100644 index 00000000..d54d0935 --- /dev/null +++ b/.github/workflows/update-dependencies.yml @@ -0,0 +1,43 @@ +name: Update Go Dependencies + +on: + schedule: + - cron: '0 0 * * 1' # Запуск каждую неделю (понедельник в 00:00 UTC) + workflow_dispatch: # Позволяет запускать вручную + +jobs: + update: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version-file: go.mod + + - name: Update dependencies + run: | + go get -u ./... + go mod tidy + + - name: Check for changes + run: | + if ! git diff --exit-code go.mod go.sum; then + echo "changes=true" >> $GITHUB_ENV + else + echo "changes=false" >> $GITHUB_ENV + fi + + - name: Commit and push changes + if: env.changes == 'true' + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + git add go.mod go.sum + git commit -m "chore(deps): update Go dependencies" + git push origin ${{ github.ref }}