Skip to content

Commit c821e8b

Browse files
committed
+changelog-ignore: fix create-pr action
1 parent 7bfd373 commit c821e8b

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

.github/workflows/create-pr.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
default: false
99
type: boolean
1010
schedule:
11-
- cron: '0 2 * * *'
11+
- cron: "0 2 * * *"
1212
jobs:
1313
get-branches:
1414
outputs:
@@ -34,7 +34,7 @@ jobs:
3434
strategy:
3535
max-parallel: 1
3636
matrix:
37-
branch: ${{fromJson(needs.get-branches.outputs.branches)}}
37+
branch: ${{fromJson(needs.get-branches.outputs.branches)}}
3838
runs-on: ubuntu-latest
3939
env:
4040
DRY_RUN: ${{ contains(github.event.inputs.dry-run, 'true') }}
@@ -43,25 +43,49 @@ jobs:
4343
run: |
4444
TARGET=$(echo ${{ matrix.branch }} | sed 's/dev\///')
4545
SOURCE=${{ matrix.branch }}
46+
# Extract major version from TARGET by removing all non-digit characters
47+
MAJOR_VERSION=$(echo "$TARGET" | tr -dc '0-9')
4648
4749
if [ -z "$TARGET" ]; then
4850
echo "TARGET is empty"
4951
exit 1
5052
fi
51-
53+
5254
if [ -z "$SOURCE" ]; then
5355
echo "SOURCE is empty"
5456
exit 1
5557
fi
5658
59+
if [ -z "$MAJOR_VERSION" ]; then
60+
echo "MAJOR_VERSION is empty"
61+
exit 1
62+
fi
63+
64+
ACTION_VERSION="1"
65+
if [[ "$MAJOR_VERSION" -lt "17" ]]; then
66+
ACTION_VERSION="0"
67+
fi
68+
5769
echo "SOURCE=$SOURCE"
5870
echo "TARGET=$TARGET"
71+
echo "ACTION_VERSION=$ACTION_VERSION"
5972
73+
echo "ACTION_VERSION=$ACTION_VERSION" >> $GITHUB_ENV
6074
echo "SOURCE=$SOURCE" >> $GITHUB_ENV
6175
echo "TARGET=$TARGET" >> $GITHUB_ENV
62-
- name: Create Pull Request
63-
id: create-pull-request
64-
uses: jcdcdev/jcdcdev.GitHub.CreatePullRequest@main
76+
- name: Create Pull Request - Action v0
77+
if: ${{ env.ACTION_VERSION == '0' }}
78+
id: create-pull-request-v0
79+
uses: jcdcdev/jcdcdev.GitHub.CreatePullRequest@v0
80+
with:
81+
source-branch: ${{ env.SOURCE }}
82+
target-branch: ${{ env.TARGET }}
83+
dry-run: ${{ env.DRY_RUN }}
84+
github-token: ${{ secrets.JCDC_BOT_TOKEN }}
85+
- name: Create Pull Request - Action v1
86+
if: ${{ env.ACTION_VERSION == '1' }}
87+
id: create-pull-request-v1
88+
uses: jcdcdev/jcdcdev.GitHub.CreatePullRequest@v1
6589
with:
6690
source-branch: ${{ env.SOURCE }}
6791
target-branch: ${{ env.TARGET }}

0 commit comments

Comments
 (0)