Skip to content

Commit a83ca4d

Browse files
committed
ci
1 parent 83a2022 commit a83ca4d

File tree

2 files changed

+77
-77
lines changed

2 files changed

+77
-77
lines changed

.github/workflows/ci.yml

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ env:
2424
jobs:
2525
build:
2626
name: Build and Test
27-
if: "!(github.event_name == 'pull_request' && github.event.pull_request.draft) && !(github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master') && !startsWith(github.event.head_commit.message, 'Version release'))"
27+
if: '!(github.event_name == ''pull_request'' && github.event.pull_request.draft) && !(github.event_name == ''push'' && (github.ref == ''refs/heads/main'' || github.ref == ''refs/heads/master'') && !startsWith(github.event.head_commit.message, ''Version release''))'
2828
strategy:
2929
matrix:
3030
os: [ubuntu-latest]
@@ -55,7 +55,7 @@ jobs:
5555
- run: $SBT '++ ${{ matrix.scala }}' ci
5656

5757
- name: Compress target directories
58-
run: tar cf targets.tar target modules/jdbc/target modules/jdbc-testkit/target project/target
58+
run: tar cf targets.tar target core/target project/target
5959

6060
- name: Upload target directories
6161
uses: actions/upload-artifact@v3
@@ -110,7 +110,7 @@ jobs:
110110
auto-merge:
111111
name: Auto Merge
112112
needs: [build]
113-
if: "github.event_name == 'pull_request' && contains(github.head_ref, 'version-bump') && contains(github.event.pull_request.labels.*.name, 'version: revision')"
113+
if: 'github.event_name == ''pull_request'' && contains(github.head_ref, ''version-bump'') && contains(github.event.pull_request.labels.*.name, ''version: revision'')'
114114
strategy:
115115
matrix:
116116
os: [ubuntu-latest]
@@ -123,11 +123,11 @@ jobs:
123123
uses: actions/github-script@v6
124124
with:
125125
script: |
126-
github.rest.pulls.merge({
127-
owner: context.repo.owner,
128-
repo: context.repo.repo,
129-
pull_number: ${{ github.event.pull_request.number }},
130-
});
126+
github.rest.pulls.merge({
127+
owner: context.repo.owner,
128+
repo: context.repo.repo,
129+
pull_number: ${{ github.event.pull_request.number }},
130+
});
131131
github-token: ${{ secrets.PRECOG_GITHUB_TOKEN }}
132132

133133
check-labels:
@@ -143,8 +143,8 @@ jobs:
143143
- name: Check PR labels
144144
uses: docker://agilepathway/pull-request-label-checker:v1.4.30
145145
with:
146-
one_of: "version: breaking,version: feature,version: revision,version: release"
147-
none_of: ":stop_sign:"
146+
one_of: 'version: breaking,version: feature,version: revision,version: release'
147+
none_of: ':stop_sign:'
148148
repo_token: ${{ env.GITHUB_TOKEN }}
149149

150150
next-version:
@@ -171,72 +171,72 @@ jobs:
171171
uses: actions/github-script@v6
172172
with:
173173
script: |
174-
const currentVersion = '${{steps.current_version.outputs.CURRENT_VERSION}}'
175-
const parsedVersion = currentVersion.split(".")
176-
var major = Number(parsedVersion[0])
177-
var minor = Number(parsedVersion[1])
178-
var patch = Number(parsedVersion[2])
179-
180-
const prResponse = await github.rest.repos.listPullRequestsAssociatedWithCommit({
181-
owner: context.repo.owner,
182-
repo: context.repo.repo,
183-
commit_sha: context.sha
184-
})
185-
186-
const prs = prResponse.data
187-
188-
if (prs === undefined) {
189-
throw new Error("Could not fetch PRs for commit: status " + prs.status)
190-
} else if (prs.length > 1) {
191-
throw new Error("Cannot determine version increment required as there is more than one PR associated with the commit: " + context.sha)
192-
} else if (prs.length === 0) {
193-
throw new Error("Cannot determine version increment required as there are no PRs associated with the commit: " + context.sha)
194-
}
195-
196-
const pr = prs[0]
197-
198-
for (const label of pr.labels) {
199-
if (label.name === 'version: revision') {
200-
patch = patch + 1
201-
break
202-
} else if (label.name === 'version: feature') {
203-
patch = 0
204-
minor = minor + 1
205-
break
206-
} else if (label.name === 'version: breaking') {
207-
major = major + 1
208-
minor = 0
209-
patch = 0
210-
break
211-
} else if (label.name === 'version: release') {
212-
major = major + 1
213-
minor = 0
214-
patch = 0
215-
break
216-
}
217-
}
218-
219-
const nextVersion = major + '.' + minor + '.' + patch
220-
221-
if (nextVersion === currentVersion) {
222-
throw new Error("Could not detect the version label on PR " + pr.number + " (obtained via association to commit " + context.sha + ")")
223-
}
224-
225-
console.log("Setting the next version to " + nextVersion)
226-
227-
var body = ""
228-
if (pr.body === undefined || pr.body === null || pr.body === "") {
229-
body = ""
230-
} else {
231-
body = "\n" + pr.body.replaceAll("\r\n", "\n")
232-
}
233-
234-
// set outputs for
235-
const result = {
236-
nextVersion: nextVersion,
237-
commitMessage: "Version release: " + nextVersion + "\n\n" + pr.title + body
238-
}
239-
return result
174+
const currentVersion = '${{steps.current_version.outputs.CURRENT_VERSION}}'
175+
const parsedVersion = currentVersion.split(".")
176+
var major = Number(parsedVersion[0])
177+
var minor = Number(parsedVersion[1])
178+
var patch = Number(parsedVersion[2])
179+
180+
const prResponse = await github.rest.repos.listPullRequestsAssociatedWithCommit({
181+
owner: context.repo.owner,
182+
repo: context.repo.repo,
183+
commit_sha: context.sha
184+
})
185+
186+
const prs = prResponse.data
187+
188+
if (prs === undefined) {
189+
throw new Error("Could not fetch PRs for commit: status " + prs.status)
190+
} else if (prs.length > 1) {
191+
throw new Error("Cannot determine version increment required as there is more than one PR associated with the commit: " + context.sha)
192+
} else if (prs.length === 0) {
193+
throw new Error("Cannot determine version increment required as there are no PRs associated with the commit: " + context.sha)
194+
}
195+
196+
const pr = prs[0]
197+
198+
for (const label of pr.labels) {
199+
if (label.name === 'version: revision') {
200+
patch = patch + 1
201+
break
202+
} else if (label.name === 'version: feature') {
203+
patch = 0
204+
minor = minor + 1
205+
break
206+
} else if (label.name === 'version: breaking') {
207+
major = major + 1
208+
minor = 0
209+
patch = 0
210+
break
211+
} else if (label.name === 'version: release') {
212+
major = major + 1
213+
minor = 0
214+
patch = 0
215+
break
216+
}
217+
}
218+
219+
const nextVersion = major + '.' + minor + '.' + patch
220+
221+
if (nextVersion === currentVersion) {
222+
throw new Error("Could not detect the version label on PR " + pr.number + " (obtained via association to commit " + context.sha + ")")
223+
}
224+
225+
console.log("Setting the next version to " + nextVersion)
226+
227+
var body = ""
228+
if (pr.body === undefined || pr.body === null || pr.body === "") {
229+
body = ""
230+
} else {
231+
body = "\n" + pr.body.replaceAll("\r\n", "\n")
232+
}
233+
234+
// set outputs for
235+
const result = {
236+
nextVersion: nextVersion,
237+
commitMessage: "Version release: " + nextVersion + "\n\n" + pr.title + body
238+
}
239+
return result
240240
241241
- name: Modify version
242242
id: modify_version

.github/workflows/clean.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,4 @@ jobs:
5656
printf "Deleting '%s' #%d, %'d bytes\n" $name ${ARTCOUNT[$name]} $size
5757
ghapi -X DELETE $REPO/actions/artifacts/$id
5858
done
59-
done
59+
done

0 commit comments

Comments
 (0)