Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Automate helm test/doc update for renovate PR #6270

Merged
merged 5 commits into from
Oct 6, 2023
Merged
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
74 changes: 74 additions & 0 deletions .github/workflows/generate-docs-helm-tests-renovate-pr.yml
Original file line number Diff line number Diff line change
@@ -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
Loading