Skip to content

Commit

Permalink
chore: Improve automation logic for reading release branches (opendat…
Browse files Browse the repository at this point in the history
  • Loading branch information
AjayJagan authored Jun 24, 2024
1 parent 9be146f commit d8acb0b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
10 changes: 7 additions & 3 deletions .github/scripts/get-component-release-notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ module.exports = ({ github, core }) => {
issueCommentBody = issue.body_text
if (issueCommentBody.includes("#Release#")) {
let components = issueCommentBody.split("\n")
components = components.splice(2, components.length - 1)
const releaseIdx = components.indexOf("#Release#")
components = components.splice(releaseIdx + 1, components.length - 1)
const regex = /[A-Za-z-_0-9]+\|(https:\/\/github\.com\/.*tree.*){1}\|(https:\/\/github\.com\/.*releases.*){1}/gm;
components.forEach(component => {
[componentName, branchUrl, tagUrl] = component.split("|")
outputStr += `- **${componentName.charAt(0).toUpperCase() + componentName.slice(1)}**: ${tagUrl}\n`
if (regex.test(component)) {
[componentName, branchUrl, tagUrl] = component.split("|")
outputStr += `- **${componentName.trim().charAt(0).toUpperCase() + componentName.trim().slice(1)}**: ${tagUrl.trim()}\n`
}
})
}
})
Expand Down
26 changes: 16 additions & 10 deletions .github/scripts/get-release-branches.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,23 @@ module.exports = ({ github, core }) => {
issueCommentBody = issue.body_text
if (issueCommentBody.includes("#Release#")) {
let components = issueCommentBody.split("\n")
components = components.splice(2, components.length - 1)
const releaseIdx = components.indexOf("#Release#")
components = components.splice(releaseIdx + 1, components.length - 1)
const regex = /[A-Za-z-_0-9]+\|(https:\/\/github\.com\/.*tree.*){1}\|(https:\/\/github\.com\/.*releases.*){1}/gm;
components.forEach(component => {
[componentName, branchUrl] = component.split("|")
const splitArr = branchUrl.split("/")
const idx = splitArr.indexOf("tree")
const branchName = splitArr.slice(idx + 1).join("/")
if(componentName === "notebook-controller"){
core.exportVariable("component_spec_odh-notebook-controller".toLowerCase(), branchName);
core.exportVariable("component_spec_kf-notebook-controller".toLowerCase(), branchName);
}else{
core.exportVariable("component_spec_"+componentName.toLowerCase(), branchName);
if (regex.test(component)) {
[componentName, branchUrl] = component.split("|")
componentName = componentName.trim()
branchUrl = branchUrl.trim()
const splitArr = branchUrl.split("/")
const idx = splitArr.indexOf("tree")
const branchName = splitArr.slice(idx + 1).join("/")
if (componentName === "notebook-controller") {
core.exportVariable("component_spec_odh-notebook-controller".toLowerCase(), branchName);
core.exportVariable("component_spec_kf-notebook-controller".toLowerCase(), branchName);
} else {
core.exportVariable("component_spec_" + componentName.toLowerCase(), branchName);
}
}
})
}
Expand Down

0 comments on commit d8acb0b

Please sign in to comment.