From abcdab93f3fdf0a93c9b908f8a69fda42701d94b Mon Sep 17 00:00:00 2001 From: fantonangeli Date: Fri, 12 Apr 2024 17:58:24 +0200 Subject: [PATCH 01/14] Add upstream-sync workflow --- .ci/actions/upstream-sync/action.yml | 47 ++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .ci/actions/upstream-sync/action.yml diff --git a/.ci/actions/upstream-sync/action.yml b/.ci/actions/upstream-sync/action.yml new file mode 100644 index 00000000..ab7383fe --- /dev/null +++ b/.ci/actions/upstream-sync/action.yml @@ -0,0 +1,47 @@ +name: Sync main-apache branch with upstream/main + +inputs: + username: + description: 'Git username' + required: true + useremail: + description: 'Git user email' + required: true + upstream_remote: + description: 'URL of the upstream remote repository' + required: true + github_token: + description: 'GitHub token for authentication' + required: true + +runs: + using: 'composite' + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + token: ${{ inputs.github_token }} + + - name: Setup git environment + run: | + git config --global user.name "${{ inputs.username }}" + git config --global user.email "${{ inputs.useremail }}" + git remote add upstream ${{ inputs.upstream_remote }} + + - name: 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 + + - name: Push last tag + run: git push origin $(git tag --sort=creatordate | tail -n 1) From 3d31bd0cdfa7f11bbee25c236e0091cf266a694e Mon Sep 17 00:00:00 2001 From: fantonangeli Date: Wed, 17 Apr 2024 18:14:23 +0200 Subject: [PATCH 02/14] Updated workflow --- .ci/actions/upstream-sync/action.yml | 40 ++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/.ci/actions/upstream-sync/action.yml b/.ci/actions/upstream-sync/action.yml index ab7383fe..cdd45845 100644 --- a/.ci/actions/upstream-sync/action.yml +++ b/.ci/actions/upstream-sync/action.yml @@ -1,47 +1,65 @@ -name: Sync main-apache branch with upstream/main +name: 'Sync main-apache branch' +description: 'Sync main-apache branch with upstream/main' inputs: username: - description: 'Git username' - required: true + description: 'Username for git' + required: false + default: kie-ci useremail: - description: 'Git user email' - required: true + description: 'User email for git' + required: false + default: kie-ci0@redhat.com upstream_remote: description: 'URL of the upstream remote repository' required: true - github_token: - description: 'GitHub token for authentication' - required: true + dry_run: + description: 'True to perform a dry run (dry run git push and skip create PR step)' + required: false + default: false runs: + # TODO: uncomment + # if: github.repository_owner == 'kiegroup' using: 'composite' steps: - name: Checkout repository uses: actions/checkout@v4 with: - token: ${{ inputs.github_token }} + token: $GITHUB_TOKEN - name: Setup git environment + shell: bash run: | + set -x git config --global user.name "${{ inputs.username }}" git config --global user.email "${{ inputs.useremail }}" git remote add upstream ${{ inputs.upstream_remote }} - name: Fetch all + shell: bash run: git fetch --all --tags - name: Checkout main-apache branch + shell: bash run: git checkout --track origin/main-apache - name: Pull main-apache branch + shell: bash run: git pull - name: Merge upstream/main branch + shell: bash run: git merge --no-edit upstream/main - name: Push changes - run: git push + shell: bash + run: | + set -x + git push${{ inputs.dry_run == 'true' && ' --dry-run' || '' }} - name: Push last tag - run: git push origin $(git tag --sort=creatordate | tail -n 1) + shell: bash + run: | + set -x + git push origin $(git tag --sort=creatordate | tail -n 1)${{ inputs.dry_run == 'true' && ' --dry-run' || '' }} From 1d860247a840f1195ceac71411d4da898ebde2e6 Mon Sep 17 00:00:00 2001 From: fantonangeli Date: Mon, 22 Apr 2024 11:46:31 +0200 Subject: [PATCH 03/14] Fix err "not a git repository" testing with act --- .ci/actions/upstream-sync/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/actions/upstream-sync/action.yml b/.ci/actions/upstream-sync/action.yml index cdd45845..47522b81 100644 --- a/.ci/actions/upstream-sync/action.yml +++ b/.ci/actions/upstream-sync/action.yml @@ -27,6 +27,7 @@ runs: uses: actions/checkout@v4 with: token: $GITHUB_TOKEN + ref: main - name: Setup git environment shell: bash From 30369c09c8a926b4b5812b55443c37bf85ec47d5 Mon Sep 17 00:00:00 2001 From: fantonangeli Date: Mon, 22 Apr 2024 12:09:03 +0200 Subject: [PATCH 04/14] Fixed tab space --- .ci/actions/upstream-sync/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/actions/upstream-sync/action.yml b/.ci/actions/upstream-sync/action.yml index 47522b81..6cbe82a6 100644 --- a/.ci/actions/upstream-sync/action.yml +++ b/.ci/actions/upstream-sync/action.yml @@ -32,7 +32,7 @@ runs: - name: Setup git environment shell: bash run: | - set -x + set -x git config --global user.name "${{ inputs.username }}" git config --global user.email "${{ inputs.useremail }}" git remote add upstream ${{ inputs.upstream_remote }} From 694da64097451de5d19614b9049ed1737ea3596a Mon Sep 17 00:00:00 2001 From: fantonangeli Date: Mon, 22 Apr 2024 12:12:31 +0200 Subject: [PATCH 05/14] Fix tab --- .ci/actions/upstream-sync/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/actions/upstream-sync/action.yml b/.ci/actions/upstream-sync/action.yml index 6cbe82a6..a3f91e4f 100644 --- a/.ci/actions/upstream-sync/action.yml +++ b/.ci/actions/upstream-sync/action.yml @@ -32,7 +32,7 @@ runs: - name: Setup git environment shell: bash run: | - set -x + set -x git config --global user.name "${{ inputs.username }}" git config --global user.email "${{ inputs.useremail }}" git remote add upstream ${{ inputs.upstream_remote }} From 37158fe307eda9101f661b9045ed914ffd6d33c9 Mon Sep 17 00:00:00 2001 From: fantonangeli Date: Mon, 22 Apr 2024 15:59:53 +0200 Subject: [PATCH 06/14] Trying without the token as param to actions/checkout --- .ci/actions/upstream-sync/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.ci/actions/upstream-sync/action.yml b/.ci/actions/upstream-sync/action.yml index a3f91e4f..c48e04d4 100644 --- a/.ci/actions/upstream-sync/action.yml +++ b/.ci/actions/upstream-sync/action.yml @@ -26,7 +26,6 @@ runs: - name: Checkout repository uses: actions/checkout@v4 with: - token: $GITHUB_TOKEN ref: main - name: Setup git environment From f76b05cd905de73ff627917f8772e64acf799045 Mon Sep 17 00:00:00 2001 From: fantonangeli Date: Mon, 29 Apr 2024 11:29:54 +0200 Subject: [PATCH 07/14] Uncomment owner check --- .ci/actions/upstream-sync/action.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.ci/actions/upstream-sync/action.yml b/.ci/actions/upstream-sync/action.yml index c48e04d4..67f66155 100644 --- a/.ci/actions/upstream-sync/action.yml +++ b/.ci/actions/upstream-sync/action.yml @@ -19,8 +19,7 @@ inputs: default: false runs: - # TODO: uncomment - # if: github.repository_owner == 'kiegroup' + if: github.repository_owner == 'kiegroup' using: 'composite' steps: - name: Checkout repository From 1019e61458158a601c39376a2168f782268528dc Mon Sep 17 00:00:00 2001 From: fantonangeli Date: Fri, 3 May 2024 19:14:15 +0200 Subject: [PATCH 08/14] Changed owner value after test --- .ci/actions/upstream-sync/action.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.ci/actions/upstream-sync/action.yml b/.ci/actions/upstream-sync/action.yml index 67f66155..c673081b 100644 --- a/.ci/actions/upstream-sync/action.yml +++ b/.ci/actions/upstream-sync/action.yml @@ -19,9 +19,13 @@ inputs: default: false runs: - if: github.repository_owner == 'kiegroup' using: 'composite' steps: + - name: Terminate if the repository owner is not kiegroup + if: github.repository_owner != 'kiegroup' + shell: bash + run: exit 1 + - name: Checkout repository uses: actions/checkout@v4 with: From d36efa84048312ab3b3009b5835f7254e2d35e82 Mon Sep 17 00:00:00 2001 From: fantonangeli Date: Sat, 4 May 2024 12:36:26 +0200 Subject: [PATCH 09/14] Show a message is the repository_owner is not kiegroup --- .ci/actions/upstream-sync/action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.ci/actions/upstream-sync/action.yml b/.ci/actions/upstream-sync/action.yml index c673081b..e8bece0a 100644 --- a/.ci/actions/upstream-sync/action.yml +++ b/.ci/actions/upstream-sync/action.yml @@ -24,7 +24,9 @@ runs: - name: Terminate if the repository owner is not kiegroup if: github.repository_owner != 'kiegroup' shell: bash - run: exit 1 + run: | + echo "Teminating the workflow: repository owner is not kiegroup" + exit 1 - name: Checkout repository uses: actions/checkout@v4 From 9fbc04b9511dcf23a2843f0567968862474234d7 Mon Sep 17 00:00:00 2001 From: fantonangeli Date: Sat, 4 May 2024 12:48:48 +0200 Subject: [PATCH 10/14] Testing with fantonangeli owner --- .ci/actions/main-sync/action.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.ci/actions/main-sync/action.yml b/.ci/actions/main-sync/action.yml index a050c7f3..177db46e 100644 --- a/.ci/actions/main-sync/action.yml +++ b/.ci/actions/main-sync/action.yml @@ -24,9 +24,15 @@ inputs: default: false runs: - if: github.repository_owner == 'kiegroup' using: 'composite' steps: + - name: Terminate if the repository owner is not kiegroup + if: github.repository_owner != 'fantonangeli' + shell: bash + run: | + echo "Teminating the workflow: repository owner is not kiegroup" + exit 1 + - name: Generate PR ID id: generate_pr_id shell: bash From 0b68a3b0ae665d07de30d4e8c134e39a1ad31912 Mon Sep 17 00:00:00 2001 From: fantonangeli Date: Sat, 4 May 2024 13:00:08 +0200 Subject: [PATCH 11/14] Set kiegroup owner check after tests --- .ci/actions/main-sync/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/actions/main-sync/action.yml b/.ci/actions/main-sync/action.yml index 177db46e..d019c033 100644 --- a/.ci/actions/main-sync/action.yml +++ b/.ci/actions/main-sync/action.yml @@ -27,7 +27,7 @@ runs: using: 'composite' steps: - name: Terminate if the repository owner is not kiegroup - if: github.repository_owner != 'fantonangeli' + if: github.repository_owner != 'kiegroup' shell: bash run: | echo "Teminating the workflow: repository owner is not kiegroup" From df15a74a238f25114bd307984c93eb3739a41554 Mon Sep 17 00:00:00 2001 From: Fabrizio Antonangeli Date: Mon, 6 May 2024 08:51:14 +0200 Subject: [PATCH 12/14] Update .ci/actions/main-sync/action.yml Co-authored-by: Roberto Oliveira --- .ci/actions/main-sync/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/actions/main-sync/action.yml b/.ci/actions/main-sync/action.yml index d019c033..aab073b2 100644 --- a/.ci/actions/main-sync/action.yml +++ b/.ci/actions/main-sync/action.yml @@ -30,7 +30,7 @@ runs: if: github.repository_owner != 'kiegroup' shell: bash run: | - echo "Teminating the workflow: repository owner is not kiegroup" + echo "Terminating the workflow: repository owner is not kiegroup" exit 1 - name: Generate PR ID From 793475700eed3eeeef701e4dc2f5e8c75f5684ec Mon Sep 17 00:00:00 2001 From: Fabrizio Antonangeli Date: Mon, 6 May 2024 08:51:34 +0200 Subject: [PATCH 13/14] Update .ci/actions/upstream-sync/action.yml Co-authored-by: Roberto Oliveira --- .ci/actions/upstream-sync/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/actions/upstream-sync/action.yml b/.ci/actions/upstream-sync/action.yml index e8bece0a..276d0d35 100644 --- a/.ci/actions/upstream-sync/action.yml +++ b/.ci/actions/upstream-sync/action.yml @@ -25,7 +25,7 @@ runs: if: github.repository_owner != 'kiegroup' shell: bash run: | - echo "Teminating the workflow: repository owner is not kiegroup" + echo "Terminating the workflow: repository owner is not kiegroup" exit 1 - name: Checkout repository From 24048209ac2b0009cb93d148c53752bd5a99e88d Mon Sep 17 00:00:00 2001 From: fantonangeli Date: Mon, 6 May 2024 15:09:13 +0200 Subject: [PATCH 14/14] Fixes comment: https://github.com/kiegroup/kie-ci/pull/1555#discussion_r1590733199 --- .ci/actions/main-sync/action.yml | 7 ------- .ci/actions/upstream-sync/action.yml | 7 ------- 2 files changed, 14 deletions(-) diff --git a/.ci/actions/main-sync/action.yml b/.ci/actions/main-sync/action.yml index aab073b2..ea7b4972 100644 --- a/.ci/actions/main-sync/action.yml +++ b/.ci/actions/main-sync/action.yml @@ -26,13 +26,6 @@ inputs: runs: using: 'composite' steps: - - name: Terminate if the repository owner is not kiegroup - if: github.repository_owner != 'kiegroup' - shell: bash - run: | - echo "Terminating the workflow: repository owner is not kiegroup" - exit 1 - - name: Generate PR ID id: generate_pr_id shell: bash diff --git a/.ci/actions/upstream-sync/action.yml b/.ci/actions/upstream-sync/action.yml index 276d0d35..4055d199 100644 --- a/.ci/actions/upstream-sync/action.yml +++ b/.ci/actions/upstream-sync/action.yml @@ -21,13 +21,6 @@ inputs: runs: using: 'composite' steps: - - name: Terminate if the repository owner is not kiegroup - if: github.repository_owner != 'kiegroup' - shell: bash - run: | - echo "Terminating the workflow: repository owner is not kiegroup" - exit 1 - - name: Checkout repository uses: actions/checkout@v4 with: