temp: add pitr logic #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto Sync Addons CR | |
on: | |
push: | |
paths: | |
- "addons/**" | |
branches: | |
- 'main' | |
- 'release-*' | |
env: | |
GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
jobs: | |
sync-addons-cr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout kubeblocks-addons Code | |
uses: actions/checkout@v4 | |
- name: Checkout block-index Code | |
uses: actions/checkout@v4 | |
with: | |
repository: apecloud/block-index | |
path: ./block-index | |
token: ${{ env.GITHUB_TOKEN }} | |
- name: check addons cr | |
id: check-addons-cr | |
run: | | |
addons_list=$(ls addons) | |
python3 hack/gen-addon-crs.py $(echo $addons_list) | |
if [[ -d "temp" ]]; then | |
cd ./block-index | |
git fetch --prune --unshallow | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
block_index_sha=$(git rev-parse HEAD) | |
cp -r ${{ github.workspace }}/temp/* ${{ github.workspace }}/block-index/addons | |
git add ${{ github.workspace }}/block-index/addons/* | |
FILE_CHANGES=`git diff --name-only ${block_index_sha}` | |
if [[ ! -z "$FILE_CHANGES" ]]; then | |
echo "FILE_CHANGES:"$FILE_CHANGES | |
git config --local user.name "$GITHUB_ACTOR" | |
git config --local user.email "[email protected]" | |
git commit -a -m "chore: auto sync addons cr" | |
fi | |
echo file_changes=$FILE_CHANGES >> $GITHUB_OUTPUT | |
fi | |
- name: Push addons cr changes to block-index | |
uses: ad-m/github-push-action@master | |
if: ${{ steps.check-addons-cr.outputs.file_changes }} | |
with: | |
directory: ./block-index | |
github_token: ${{ env.GITHUB_TOKEN }} | |
repository: apecloud/block-index |