-
Notifications
You must be signed in to change notification settings - Fork 39
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 #1165 from andrew-bierman/optimize-native-deployme…
…nt-pipeline 🔥Native deployment pipeline
- Loading branch information
Showing
9 changed files
with
174 additions
and
396 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Creates a comment to show native preview build status | ||
# Or finds the comment if it exists | ||
# Exposes the comment id in env in either case | ||
name: Find or create comment | ||
description: 'Finds the comment of build status or create one. Outputs the comment id.' | ||
|
||
inputs: | ||
github-token: | ||
description: 'Github token' | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Find or create comment | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ inputs.github-token }} | ||
script: | | ||
const buildName = '${{ env.build-name }}'; | ||
const commentMagicPrefix = '${{ env.comment-unique-magic-prefix }}'; | ||
const comments = await github.rest.issues.listComments({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
}); | ||
const existingComment = comments.data.find(comment => comment.body.startsWith(commentMagicPrefix)); | ||
if (existingComment) { | ||
core.exportVariable('comment_id', existingComment.id) | ||
} else { | ||
const commentBody = `${commentMagicPrefix}\n🚀 ${buildName} build has started... Please wait for the results! 🕐`; | ||
const { data: { id: commentId } } = await github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: commentBody | ||
}); | ||
core.exportVariable('comment_id', commentId) | ||
} |
39 changes: 39 additions & 0 deletions
39
.github/actions/update-native-preview-build-status/action.yml
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,39 @@ | ||
name: Update build status | ||
description: 'Updates build status comment with the build results' | ||
|
||
inputs: | ||
github-token: | ||
description: 'Github token' | ||
required: true | ||
build-outcome: | ||
description: 'Build outcome' | ||
required: true | ||
|
||
runs: | ||
using: 'composite' | ||
steps: | ||
- name: Update build status | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ inputs.github-token }} | ||
script: | | ||
const commentId = '${{ env.comment_id }}'; | ||
const buildOutcome = '${{ inputs.build-outcome }}'; | ||
const buildStatus = buildOutcome == 'success' ? 'completed' : 'failed'; | ||
const buildName = '${{ env.build-name }}'; | ||
const workflowUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; | ||
let commentBody = `${{ env.comment-unique-magic-prefix }}\n${buildName} build ${buildStatus}!`; | ||
if (buildOutcome == 'success') { | ||
commentBody += `\nYou can download the ${buildName} from the following link:\n${workflowUrl}#artifacts`; | ||
} else { | ||
commentBody += '\nPlease check the workflow logs for more details on the build failure.'; | ||
} | ||
await github.rest.issues.updateComment({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
comment_id: commentId, | ||
body: commentBody | ||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.