From 6219b5736826c114a01224c5dd6592e876f25ab7 Mon Sep 17 00:00:00 2001 From: fantonangeli Date: Wed, 20 Dec 2023 16:49:00 +0100 Subject: [PATCH 1/2] Created upstream-sync workflow --- .github/workflows/upstream-sync.yml | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/upstream-sync.yml diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml new file mode 100644 index 000000000..5b14a198d --- /dev/null +++ b/.github/workflows/upstream-sync.yml @@ -0,0 +1,39 @@ +name: Sync main-apache branch with upstream/main + +env: + USERNAME: github-actions[bot] + USEREMAIL: github-actions[bot]@users.noreply.github.com + UPSTREAM_REMOTE: https://github.com/apache/incubator-kie-kogito-serverless-operator.git + +on: + schedule: + - cron: "0 0 * * *" # every day at midnight + workflow_dispatch: + +jobs: + sync-main-apache: + name: Sync main-apache branch + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Setup git environment + run: | + git config --global user.name "$USERNAME" + git config --global user.email "$USEREMAIL" + git remote add upstream $UPSTREAM_REMOTE + + - name: Fetch all + run: git fetch --all + + - name: Checkout main-apache branch + run: git checkout --track origin/main-apache + + - name: Merge upstream/main branch + run: git merge --no-edit upstream/main + + - name: Push changes + run: git push origin main-apache + From 7f09c44b840126cc54ff20e94f6f4839b11818c6 Mon Sep 17 00:00:00 2001 From: fantonangeli Date: Fri, 26 Jan 2024 10:28:18 +0100 Subject: [PATCH 2/2] Add use of the right GH Token and push last tag --- .github/workflows/upstream-sync.yml | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/upstream-sync.yml b/.github/workflows/upstream-sync.yml index 5b14a198d..7ef9facaa 100644 --- a/.github/workflows/upstream-sync.yml +++ b/.github/workflows/upstream-sync.yml @@ -1,9 +1,10 @@ name: Sync main-apache branch with upstream/main env: - USERNAME: github-actions[bot] - USEREMAIL: github-actions[bot]@users.noreply.github.com + USERNAME: kie-ci + USEREMAIL: kie-ci0@redhat.com UPSTREAM_REMOTE: https://github.com/apache/incubator-kie-kogito-serverless-operator.git + GITHUB_TOKEN: ${{ secrets.APACHE_SYNC_MIDSTREAM_TOKEN }} on: schedule: @@ -17,7 +18,9 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 + with: + token: ${{ secrets.APACHE_SYNC_MIDSTREAM_TOKEN }} - name: Setup git environment run: | @@ -26,14 +29,19 @@ jobs: git remote add upstream $UPSTREAM_REMOTE - name: Fetch all - run: git fetch --all + run: git fetch --all --tags - name: Checkout main-apache branch run: git checkout --track origin/main-apache + - name: Pull main-apache branch + run: git pull + - name: Merge upstream/main branch run: git merge --no-edit upstream/main - name: Push changes - run: git push origin main-apache + run: git push + - name: Push last tag + run: git push origin $(git tag --sort=creatordate | tail -n 1)