Skip to content

Commit

Permalink
fix: missing username
Browse files Browse the repository at this point in the history
  • Loading branch information
coltenkrauter committed Sep 25, 2024
1 parent cdeef1d commit 7eb9417
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,6 @@ jobs:
github-token: ${{ secrets.GH_TOKEN_GH_NOTIFIER }}
channels: C07L8EWB389
slack-token: ${{ secrets.SLACK_TOKEN_GH_NOTIFIER }}
with-test-data: true
- name: Print Output
run: echo "${{ steps.test-action.outputs.response }}"
7 changes: 4 additions & 3 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37661,7 +37661,7 @@ var core = __nccwpck_require__(2186);
// EXTERNAL MODULE: ./node_modules/@actions/github/lib/github.js
var github = __nccwpck_require__(5438);
;// CONCATENATED MODULE: ./package.json
const package_namespaceObject = JSON.parse('{"u2":"@krauters/github-notifier","i8":"0.13.0","Xh":"https://github.com/krauters/github-notifier"}');
const package_namespaceObject = JSON.parse('{"u2":"@krauters/github-notifier","i8":"0.13.1","Xh":"https://github.com/krauters/github-notifier"}');
;// CONCATENATED MODULE: ./src/defaults.ts
const scmUrl = 'https://github.com';
const prBaseUrl = `${scmUrl}/pulls?q=is%3Aopen+is%3Apr+archived%3Afalse+draft%3Afalse+user%3A`;
Expand Down Expand Up @@ -41955,7 +41955,8 @@ async function getPullBlocks(pull, slack, withUserMentions) {
email,
username,
});
const displayName = slackUser?.profile?.display_name;
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const displayName = slackUser?.profile?.display_name || slackUser?.profile?.real_name_normalized || username;
const imageUrl = slackUser?.profile?.image_72;
contextBlocks.push({
elements: [
Expand All @@ -41969,7 +41970,7 @@ async function getPullBlocks(pull, slack, withUserMentions) {
type: 'image',
},
{
text: `*${displayName ?? username}* ${context} _${relativeHumanReadableAge}_.`,
text: `*${displayName}* ${context} _${relativeHumanReadableAge}_.`,
type: 'mrkdwn',
},
],
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@krauters/github-notifier",
"description": "GitHub Notifier by Krauters – Post Open Pull Requests to Slack",
"version": "0.13.0",
"version": "0.13.1",
"author": "Colten Krauter <coltenkrauter>",
"type": "module",
"homepage": "https://github.com/krauters/github-notifier",
Expand Down
5 changes: 3 additions & 2 deletions src/utils/slack/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ export async function getPullBlocks(pull: Pull, slack: SlackClient, withUserMent
username,
})

const displayName = slackUser?.profile?.display_name
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const displayName = slackUser?.profile?.display_name || slackUser?.profile?.real_name_normalized || username
const imageUrl = slackUser?.profile?.image_72

contextBlocks.push({
Expand All @@ -160,7 +161,7 @@ export async function getPullBlocks(pull: Pull, slack: SlackClient, withUserMent
type: 'image',
},
{
text: `*${displayName ?? username}* ${context} _${relativeHumanReadableAge}_.`,
text: `*${displayName}* ${context} _${relativeHumanReadableAge}_.`,
type: 'mrkdwn',
},
],
Expand Down

0 comments on commit 7eb9417

Please sign in to comment.