Skip to content

Commit

Permalink
fix emojiStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
bayandin committed Sep 5, 2023
1 parent 8b3049b commit 809b893
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- main
- release
- ci-run/pr-*
pull_request:
# pull_request:

defaults:
run:
Expand Down
31 changes: 13 additions & 18 deletions .github/workflows/release-notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ concurrency:

on:
pull_request:
branches:
- release
# TODO: uncomment
# branches:
# - release
types:
# Default types that triggers a workflow:
# - https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request
Expand Down Expand Up @@ -40,22 +41,16 @@ jobs:
return text.replace(/#(\d+)/g, (match, prNumber) => { return `<${urlForPr(prNumber)}|#${prNumber}>` })
}
// Helper function to return an emoji for a PR status
const statusEmoji = function (pullRequest) {
const prState = pullRequest.state
const isMerged = pullRequest.merged
const action = context.payload.action
const isMerged = context.payload.pull_request.merged
let emoji = ":new:"
if (prState == "synchronize") {
emoji = ":hammer_and_wrench:" //
} else if (prState == "closed" && isMerged) {
emoji = ":pr-merged:"
} else if (prState == "closed" && !isMerged) {
emoji = ":no_entry_sign:"
}
return emoji
let statusEmoji = ":new:"
if (action == "synchronize") {
statusEmoji = ":hammer_and_wrench:" //
} else if (action == "closed" && isMerged) {
statusEmoji = ":pr-merged:"
} else if (action == "closed" && !isMerged) {
statusEmoji = ":no_entry_sign:"
}
const pullRequest = context.payload.pull_request
Expand Down Expand Up @@ -146,7 +141,7 @@ jobs:
type: "context",
elements: [{
type: "mrkdwn",
text: `${statusEmoji(pullRequest)} PR updated at <!date^${updatedAt}^{date_num} {time_secs} (local time)|${new Date().toISOString()}>`,
text: `${statusEmoji} PR updated at <!date^${updatedAt}^{date_num} {time_secs} (local time)|${new Date().toISOString()}>`,
}],
})
Expand Down

0 comments on commit 809b893

Please sign in to comment.