Skip to content

Commit

Permalink
feat: add github action to sync mellanox fork from k8swg upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
maze88 committed Jul 15, 2024
1 parent a28c842 commit 1754136
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/fork-sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
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: tgymnich/[email protected] # input `auto_approve` is broken in versions above 1.3 (https://github.com/tgymnich/fork-sync/issues/153#issuecomment-1868494745) and at least until 2.0.10
if: ${{ matrix.branch != '' }}
with:
owner: k8snetworkplumbingwg # upstream
head: master # upstream
base: ${{ matrix.branch }} # downstream
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_title: 'sync: from upstream master to ${{ matrix.branch }}'
pr_message: 'Created by [*${{ github.job }}* workflow job](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) to sync changes from [upstream](${{ github.server_url }}/k8snetworkplumbingwg/${{ github.event.repository.name }}) to [downstream](${{ github.server_url }}/${{ github.repository }}).'
personal_token: ${{ secrets.GH_TOKEN_NVIDIA_CI_CD }}
merge_method: rebase
auto_approve: true

0 comments on commit 1754136

Please sign in to comment.