-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from planningcenter/km/no-deploy
feat: Allow for `--no-deploy` argument for test releases
- Loading branch information
Showing
7 changed files
with
87 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
name: Post results to original PR | ||
inputs: | ||
results-json: | ||
description: "JSON string of results" | ||
required: true | ||
pr-number: | ||
description: "The PR number that triggered the release" | ||
required: true | ||
actor: | ||
description: "The actor that triggered the release" | ||
required: true | ||
version-tag: | ||
description: "The tag of the version release" | ||
required: true | ||
release-type: | ||
description: "The type of release" | ||
required: true | ||
proto-tag: | ||
description: "The tag of the proto release (if it exists)" | ||
required: false | ||
runs: | ||
using: "composite" | ||
steps: | ||
- uses: actions/github-script@v7 | ||
env: | ||
PR_NUMBER: ${{ inputs.pr-number }} | ||
RESULTS_JSON: ${{ inputs.results-json }} | ||
ACTOR: ${{ inputs.actor }} | ||
VERSION_TAG: ${{ inputs.version-tag }} | ||
RELEASE_TYPE: ${{ inputs.release-type }} | ||
with: | ||
script: | | ||
function getBody() { | ||
if (!process.env.RESULTS_JSON) return "" | ||
const results = JSON.parse(process.env.RESULTS_JSON); | ||
const successfulRepoList = results.successful_repos.map(repo => `- \`${repo.name}\``).join("\n") | ||
const failedRepoList = results.failed_repos.map(repo => `- \`${repo.name}\`: ${repo.message}`).join("\n") | ||
return ` | ||
${process.env.PROTO_TAG ? "You can access the proto release at: https://${process.env.PROTO_TAG}.login.planningcenter.ninja/" : ""} | ||
${results.successful_repos.length > 0 ? "### Deployed Successfully to the following repos:" : ""} | ||
${successfulRepoList} | ||
${results.failed_repos.length > 0 ? "### Failed to deploy in the following repos:" : ""} | ||
${failedRepoList} | ||
` | ||
} | ||
function getFailed() { | ||
if (!process.env.RESULTS_JSON) return false | ||
const results = JSON.parse(process.env.RESULTS_JSON); | ||
return results.failed_repos.length > 0 | ||
} | ||
function getHeader() { | ||
return `## ${process.env.RELEASE_TYPE} release ${process.env.VERSION_TAG} successfully created` | ||
} | ||
const header = getHeader() | ||
const body = getBody() | ||
const footer = `Triggered by: @${process.env.ACTOR}` | ||
github.rest.issues.createComment({ | ||
issue_number: process.env.PR_NUMBER, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: `${header} | ||
${body} | ||
${footer}` | ||
}); | ||
if (getFailed()) { | ||
throw new Error("Failed to push to all apps."); | ||
} |