diff --git a/.github/workflows/sync-api.yml b/.github/workflows/sync-api.yml new file mode 100644 index 000000000..e954c210c --- /dev/null +++ b/.github/workflows/sync-api.yml @@ -0,0 +1,28 @@ +name: Sync Api +on: + push: + paths: + - 'staging/src/github.com/clusterpedia-io/api/*' +jobs: + sync-api: + name: Sync Api + runs-on: ubuntu-latest + env: + WORKSPACE: ${{ github.workspace }}/src/github.com/clusterpedia-io/clusterpedia + GH_TOKEN: ${{ secrets.CLUSTERPEDIA_BOT_TOKEN }} + MESSAGE: ${{ github.event.head_commit.message }} + REFTYPE: ${{ github.ref_type }} + REFNAME: ${{ github.ref_name }} + REF: ${{ github.ref }} + defaults: + run: + working-directory: ${{ env.WORKSPACE }} + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + token: ${{ secrets.CLUSTERPEDIA_BOT_TOKEN }} + path: ${{ env.WORKSPACE }} + ref: ${{ github.ref }} + fetch-depth: 0 + - run: hack/sync-api.sh diff --git a/hack/sync-api.sh b/hack/sync-api.sh new file mode 100755 index 000000000..ad91f3bea --- /dev/null +++ b/hack/sync-api.sh @@ -0,0 +1,80 @@ +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail + +function usage() { + cat <