Skip to content

Commit

Permalink
Automate updates of existing helm charts (#983)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamkpickering authored Mar 12, 2024
1 parent 3dfa8ad commit 56b0cc5
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 119 deletions.
71 changes: 0 additions & 71 deletions .github/workflows/daily.yaml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/sync-fork.yml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/update-main-source.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Auto-update charts

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'

jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Configure git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Update main-source branch
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_WORKFLOW: ${{ github.workflow }}
GITHUB_REPOSITORY: ${{ github.repository }}
run: |
scripts/pull-ci-scripts
BRANCH="auto-update/$(date '+%s')"
git checkout -b "$BRANCH"
bin/partner-charts-ci auto
# exit if there are no changes
git diff --quiet main-source "$BRANCH" && exit 0
# close all existing PRs from branches starting with "auto-update"
gh pr --repo "$GITHUB_REPOSITORY" list --search 'head:auto-update' --json 'headRefName' --jq '.[] | join("\n")' | \
xargs --no-run-if-empty -n 1 gh pr --repo "$GITHUB_REPOSITORY" close
# push changes
git push --set-upstream origin "$BRANCH"
TITLE="[AUTOMATED] Auto-update charts on main-source"
BODY="This PR was created by the \"$GITHUB_WORKFLOW\" workflow. It auto-updates the helm charts on the main-source branch."
gh pr create --repo "$GITHUB_REPOSITORY" --base main-source --head "$BRANCH" --title "$TITLE" --body "$BODY"
30 changes: 30 additions & 0 deletions .github/workflows/update-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Update main branch from main-source

on:
workflow_dispatch:
push:
branches:
- main-source

jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Configure git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Update main branch with latest from main-source
run: |
# checkout action only fetches main-source, so we need to fetch main
git fetch origin main --depth 1
git checkout main
git rm -r assets index.yaml
git checkout main-source -- assets index.yaml
# exit if there are no changes
git diff-index --quiet HEAD assets index.yaml && exit 0
git commit -m "Update partner charts"
git push origin

0 comments on commit 56b0cc5

Please sign in to comment.