forked from k8snetworkplumbingwg/sriov-network-operator
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add github action to sync mellanox fork from k8swg upstream
Signed-off-by: Michael Zeevi <[email protected]>
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
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 | ||
- name: Sync | ||
if: ${{ matrix.branch != '' }} | ||
env: | ||
GH_TOKEN: ${{ secrets.GH_TOKEN_NVIDIA_CI_CD }} | ||
run: | | ||
git config user.name nvidia-ci-cd | ||
git config user.email [email protected] | ||
git remote add upstream https://github.com/k8snetworkplumbingwg/sriov-network-operator.git | ||
git log -n 3 # debug | ||
git pull --no-ff upstream master | ||
git log -n 30 # debug | ||
# git push --force origin HEAD # TODO: uncomment only after testing commands above | ||