diff --git a/.github/workflows/fork-ci.yaml b/.github/workflows/fork-ci.yaml index 3a23a211d..9a734f8e4 100644 --- a/.github/workflows/fork-ci.yaml +++ b/.github/workflows/fork-ci.yaml @@ -1,11 +1,11 @@ name: Fork Docker CI -on: - push: - branches: - - network-operator-* - tags: - - network-operator-* +# on: +# push: +# branches: +# - network-operator-* +# tags: +# - network-operator-* jobs: determine_docker_registry_and_tag: diff --git a/.github/workflows/fork-sync.yaml b/.github/workflows/fork-sync.yaml new file mode 100644 index 000000000..b0eb28d0a --- /dev/null +++ b/.github/workflows/fork-sync.yaml @@ -0,0 +1,45 @@ +# TODO: uncomment triggers for sr-iov fork-ci workflow after fork-sync works +name: Fork Sync + +on: + schedule: + - cron: '0 0 * * *' # nightly + workflow_dispatch: # enable manual trigger + +jobs: + lookup-most-recent-release-branch: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Lookup most recent release branch + id: lookup-most-recent-release-branch + run: | + git fetch --all + echo most_recent_release_branch=$(git branch --remotes --sort refname | grep network-operator- | tail -n 1 | cut -d '/' -f 2-) >> $GITHUB_OUTPUT + outputs: + most_recent_release_branch: ${{ steps.lookup-most-recent-release-branch.outputs.most_recent_release_branch }} + + sync-fork: + runs-on: ubuntu-latest + needs: lookup-most-recent-release-branch + strategy: + fail-fast: false + matrix: + branch: + - master + - ${{ needs.lookup-most-recent-release-branch.outputs.most_recent_release_branch }} + steps: + - uses: actions/checkout@v4 + if: ${{ matrix.branch != '' }} + with: + ref: ${{ matrix.branch }} + # fetch-depth: 100 + # token: ${{ secrets.GH_TOKEN_NVIDIA_CI_CD }} + # persist-credentials: true + - name: Sync + if: ${{ matrix.branch != '' }} + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # TODO: test with each token + # GH_TOKEN: ${{ secrets.GH_TOKEN_NVIDIA_CI_CD }} + run: | + gh repo sync Mellanox/sriov-network-operator --source k8snetworkplumbingwg/sriov-network-operator --branch ${{ matrix.branch }} # TODO: figure out a workaround for syncing `upstream/master->$release`