9
9
description : ' Increment on Moodle version to be checked, available: major, minor'
10
10
default : minor
11
11
dryrun :
12
- type : boolean
12
+ type : string
13
13
default : false
14
14
secrets :
15
15
RELEASE_BOT_APP_ID :
@@ -33,13 +33,10 @@ jobs:
33
33
with :
34
34
egress-policy : audit
35
35
36
- - name : Generate release token
37
- id : generate_release_token
38
- uses : tibdex/github-app-token@v2
39
- with :
40
- app_id : ${{ secrets.RELEASE_BOT_APP_ID }}
41
- private_key : ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
42
-
36
+ - name : Debug
37
+ run : |
38
+ echo "dryrun: ${{ inputs.dryrun }}"
39
+
43
40
- name : Checkout code
44
41
uses : actions/checkout@v4
45
42
98
95
# Format Moodle version number
99
96
TMP_REV=$(echo $next_version | rev)
100
97
TMP_MINOR=$(echo $TMP_REV | cut -c -2 | rev | sed 's/^0*//')
98
+ TMP_MINOR2=${TMP_MINOR:-0}
101
99
TMP_MAJOR=$(echo $TMP_REV | cut -c 3- | rev)
102
- TMP_VERSION="$TMP_MAJOR.$TMP_MINOR "
100
+ TMP_VERSION="$TMP_MAJOR.$TMP_MINOR2 "
103
101
104
102
echo "$TARGET_BRANCH ($NEXT_COMMIT) exist, newer Moodle major/minor version is available"
105
103
echo "ready=true" >> $GITHUB_OUTPUT
@@ -112,15 +110,15 @@ jobs:
112
110
fi
113
111
114
112
- name : Branch old version
115
- if : steps.next_moodle.outputs.ready == 'true' && inputs.dryrun == 'false '
113
+ if : steps.next_moodle.outputs.ready == 'true' && inputs.dryrun != 'true '
116
114
uses :
peterjgrainger/[email protected]
117
115
env :
118
116
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
119
117
with :
120
118
branch : ${{ steps.current_moodle.outputs.version }}
121
119
122
120
- name : Update source codes
123
- if : steps.next_moodle.outputs.ready == 'true' && inputs.dryrun == 'false '
121
+ if : steps.next_moodle.outputs.ready == 'true' && inputs.dryrun != 'true '
124
122
run : |
125
123
export OLD_BRANCH=${{ steps.current_moodle.outputs.branch }}
126
124
export OLD_COMMIT=${{ steps.current_moodle.outputs.commit }}
@@ -130,8 +128,16 @@ jobs:
130
128
export NEW_VERSION=${{ steps.next_moodle.outputs.version }}
131
129
./upgrade.sh
132
130
131
+ - name : Generate release token
132
+ if : steps.next_moodle.outputs.ready == 'true' && inputs.dryrun != 'true'
133
+ id : generate_release_token
134
+ uses : tibdex/github-app-token@v2
135
+ with :
136
+ app_id : ${{ secrets.RELEASE_BOT_APP_ID }}
137
+ private_key : ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
138
+
133
139
- name : Create PR
134
- if : steps.next_moodle.outputs.ready == 'true' && inputs.dryrun == 'false '
140
+ if : steps.next_moodle.outputs.ready == 'true' && inputs.dryrun != 'true '
135
141
uses : peter-evans/create-pull-request@v7
136
142
with :
137
143
token : ${{ steps.generate_release_token.outputs.token }}
0 commit comments