-
Notifications
You must be signed in to change notification settings - Fork 3
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 #407 from ghkdqhrbals/feat/eks-to-gke
fix: edit github script
- Loading branch information
Showing
2 changed files
with
31 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,41 @@ | ||
name: Notify PR Completion | ||
|
||
|
||
on: | ||
workflow_run: | ||
workflows: ["Deployment"] | ||
types: | ||
- completed | ||
workflows: [Deployment] | ||
types: [completed] | ||
|
||
jobs: | ||
notify: | ||
on-success: | ||
runs-on: ubuntu-latest | ||
if: always() | ||
if: ${{ github.event.workflow_run.conclusion == 'success' }} | ||
steps: | ||
- name: Notify on Workflow Completion | ||
- name: Notify current workflow is succeed | ||
uses: actions/github-script@v6 | ||
if: success() | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: ${{ github.event.pull_request.number }}, | ||
owner: 'ghkdqhrbals', | ||
repo: 'spring-chatting-server', | ||
body: '✅ Build & Test workflow succeed ✅\n- [Show details](https://github.com/ghkdqhrbals/spring-chatting-server/actions/runs/${{ github.run_id }})' | ||
}) | ||
on-failure: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.event.workflow_run.conclusion == 'failure' }} | ||
steps: | ||
- name: Notify current workflow is failed | ||
uses: actions/github-script@v6 | ||
if: failure() | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const status = '${{ github.event.workflow_run.conclusion }}'; | ||
const workflowName = '${{ github.event.workflow.name }}'; | ||
const runId = '${{ github.event.workflow_run.id }}'; | ||
let message; | ||
if (status === 'success') { | ||
message = `✅ Workflow ${workflowName} succeeded ✅\n- [Show details](https://github.com/owner/repo/actions/runs/${runId})`; | ||
} else { | ||
message = `❌ Workflow ${workflowName} failed ❌\n- [Show details](https://github.com/owner/repo/actions/runs/${runId})`; | ||
} | ||
github.rest.issues.createComment({ | ||
issue_number: ${{ github.event.workflow_run.head_repository.default_branch }}, | ||
owner: 'owner', | ||
repo: 'repo', | ||
body: message | ||
issue_number: ${{ github.event.pull_request.number }}, | ||
owner: 'ghkdqhrbals', | ||
repo: 'spring-chatting-server', | ||
body: '❌ Build & Test workflow failed ❌\n- [Show details](https://github.com/ghkdqhrbals/spring-chatting-server/actions/runs/${{ github.run_id }})' | ||
}) |