From 758d3ea7969be6a6cfb62e7e0ac4f70d9b55d968 Mon Sep 17 00:00:00 2001 From: Tugdual Saunier Date: Mon, 16 May 2022 17:33:41 -0400 Subject: [PATCH] Add automatic update of the generated code --- .github/workflows/go_generate_update.yml | 50 ++++++++++++++++++++++++ .github/workflows/releaser.yml | 10 ++++- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/go_generate_update.yml diff --git a/.github/workflows/go_generate_update.yml b/.github/workflows/go_generate_update.yml new file mode 100644 index 00000000..15f1567e --- /dev/null +++ b/.github/workflows/go_generate_update.yml @@ -0,0 +1,50 @@ +name: Update generated code + +on: + workflow_dispatch: ~ + schedule: + - cron: '0 8-18/4 * * 1-5' + +jobs: + update: + name: Update generated code + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.18 + - uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- + - + name: Prepare + run: go generate ./ + - + name: Check Git status + id: git + run: | + RESULT=$(git status --untracked-files=no --porcelain) + echo "::set-output name=gitstatus::$RESULT" + - + name: Test + if: steps.git.outputs.gitstatus != '' + run: go test -v ./... + - + name: Commit and push the update + if: steps.git.outputs.gitstatus != '' + run: | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config user.name "github-actions[bot]" + git add local/platformsh/commands.go local/platformsh/config.go + git commit -m "chore: Update supported Platform.sh services" + git push diff --git a/.github/workflows/releaser.yml b/.github/workflows/releaser.yml index b61cd497..91f105c1 100644 --- a/.github/workflows/releaser.yml +++ b/.github/workflows/releaser.yml @@ -23,6 +23,14 @@ jobs: uses: actions/setup-go@v2 with: go-version: 1.18 + - uses: actions/cache@v3 + with: + path: | + ~/.cache/go-build + ~/go/pkg/mod + key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go- - name: Set AUTOUPDATE_CHANNEL on tags run: echo "AUTOUPDATE_CHANNEL=stable" >> $GITHUB_ENV @@ -38,7 +46,7 @@ jobs: echo "::set-output name=gitstatus::$RESULT" - name: Check if go prepare updated generated Go code - if: steps.git.outputs.gitstatus != '' + if: steps.git.outputs.gitstatus != '' && startsWith(github.ref, 'refs/tags/v') run: | echo '"go generate" changed some Go generated code, run "symfony cloud:self-update" then "go generate ./" locally and make a Pull Request with the changes' git diff pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy