diff --git a/.github/workflows/generate-docs-helm-tests-renovate-pr.yml b/.github/workflows/generate-docs-helm-tests-renovate-pr.yml new file mode 100644 index 00000000000..a43b0a6ef14 --- /dev/null +++ b/.github/workflows/generate-docs-helm-tests-renovate-pr.yml @@ -0,0 +1,74 @@ +name: Regenerate docs and helm tests + +# configure trigger by pull request +on: + pull_request: + types: [opened, synchronize] + paths: + - 'operations/helm/**' + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + prepare: + if: github.event.pull_request.user.login == 'renovate[bot]' + runs-on: ubuntu-latest + steps: + - name: Check out repository + uses: actions/checkout@v4 + - name: Get build image from Makefile + id: build_image_step + run: echo "build_image=$(make print-build-image)" >> "$GITHUB_OUTPUT" + outputs: + build_image: ${{ steps.build_image_step.outputs.build_image }} + + lint_and_update: + runs-on: ubuntu-latest + needs: + - prepare + container: + image: ${{ needs.prepare.outputs.build_image }} + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.GH_BOT_ACCESS_TOKEN }} + + - name: Run Git Config + run: | + git config --global --add safe.directory '*' + git config --global user.email "${{ github.event.pull_request.user.login }}@users.noreply.github.com" + git config --global user.name "${{ github.event.pull_request.user.login }}" + + - name: Install the gh cli + uses: ksivamuthu/actions-setup-gh-cli@v2 + + - name: Checkout Pull Request Branch + run: gh pr checkout ${{ github.event.pull_request.number }} + env: + GITHUB_TOKEN: ${{ secrets.GH_BOT_ACCESS_TOKEN }} + + - name: Run make targets + id: update + run: | + make BUILD_IN_CONTAINER=false doc build-helm-tests + + - name: Check Updates + id: check_updates + run: | + if ./tools/find-diff-or-untracked.sh operations/helm/; then + echo "diff=0" >> "$GITHUB_OUTPUT" # Script success, no change + else + echo "diff=1" >> "$GITHUB_OUTPUT" # Script failed, changes exist + fi + + - name: Update PR + id: update_pr + if: steps.check_updates.outputs.diff != '0' + run: | + echo "Add commit for regenerating helm tests and docs" + git add operations/helm/ + git commit -m "Update build with regenerated helm tests and docs" + git push