Skip to content

Commit

Permalink
Merge branch 'main' into migration
Browse files Browse the repository at this point in the history
  • Loading branch information
tianzhou committed Mar 15, 2024
2 parents 11cc184 + b21e6c7 commit bba4393
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .github/actions/check-issue-status/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ function run() {
if (!issue) {
throw new Error(`No issue found for title ${title}`);
}
if (issue.status !== "DONE") {
core.setFailed(`Issue status is not DONE. Current status is ${issue.status}.`);
}
core.info("Issue:\n" + JSON.stringify(issue, null, 2));
core.setOutput('issue', issue);
// Sample plan. A plan is the rollout blueprint containing stages, and each stage contains tasks.
Expand Down Expand Up @@ -257,6 +260,9 @@ function run() {
for (const change of changes) {
if (task.specId === change.id && task.databaseSchemaUpdate.schemaVersion === change.schemaVersion) {
matchedChange = change;
if (task.status != "DONE") {
core.setFailed(`${change.file} rollout status is not DONE. Current status is ${task.status}.`);
}
break;
}
}
Expand Down
8 changes: 8 additions & 0 deletions .github/actions/check-issue-status/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ async function run(): Promise<void> {
if (!issue) {
throw new Error(`No issue found for title ${title}`)
}

if (issue.status !== "DONE") {
core.setFailed(`Issue status is not DONE. Current status is ${issue.status}.`)
}

core.info("Issue:\n" + JSON.stringify(issue, null, 2))
core.setOutput('issue', issue);
Expand Down Expand Up @@ -235,10 +239,14 @@ async function run(): Promise<void> {

for (const stage of rolloutData.stages) {
for (const task of stage.tasks) {

let matchedChange;
for (const change of changes) {
if (task.specId === change.id && task.databaseSchemaUpdate.schemaVersion === change.schemaVersion) {
matchedChange = change;
if (task.status != "DONE") {
core.setFailed(`${change.file} rollout status is not DONE. Current status is ${task.status}.`)
}
break;
}
}
Expand Down
8 changes: 5 additions & 3 deletions .github/actions/upsert-issue/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function run() {
// Otherwise, create a new issue.
if (issue) {
if (issue.plan) {
updateIssuePlan(issue, changes, title);
yield updateIssuePlan(issue, changes, title);
}
else {
// In theory, every issue must have a plan, otherwise issue creation will return error:
Expand All @@ -93,8 +93,10 @@ function run() {
let rollout = yield createRollout(plan.name);
// Create issue
issue = yield createIssue(plan.name, rollout.name, assignee, title, description);
const issueURL = `${url}/projects/${projectId}/issues/${issue.uid}`;
core.info("Successfully created issue at " + issueURL);
if (issue) {
const issueURL = `${url}/projects/${projectId}/issues/${issue.uid}`;
core.info("Successfully created issue at " + issueURL);
}
}
});
}
Expand Down
9 changes: 5 additions & 4 deletions .github/actions/upsert-issue/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async function run(): Promise<void> {
// Otherwise, create a new issue.
if (issue) {
if (issue.plan) {
updateIssuePlan(issue, changes, title)
await updateIssuePlan(issue, changes, title)
} else {
// In theory, every issue must have a plan, otherwise issue creation will return error:
// {"code":3, "message":"plan is required", "details":[]}
Expand All @@ -74,9 +74,10 @@ async function run(): Promise<void> {
// Create issue
issue = await createIssue(plan.name, rollout.name, assignee, title, description);


const issueURL = `${url}/projects/${projectId}/issues/${issue.uid}`
core.info("Successfully created issue at " + issueURL)
if (issue) {
const issueURL = `${url}/projects/${projectId}/issues/${issue.uid}`
core.info("Successfully created issue at " + issueURL)
}
}
}

Expand Down

0 comments on commit bba4393

Please sign in to comment.