Skip to content

Commit

Permalink
Solve - bug: manual tasks break data submission #2 (#3)
Browse files Browse the repository at this point in the history
* wip: dealing with a manual workflow

* fix: change payload.head_commit.author.name to actor on run manualy

* fix: manual tasks break data submission
  • Loading branch information
ErnaneJ authored May 7, 2023
1 parent b63088d commit 0cce70c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
13 changes: 8 additions & 5 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17628,7 +17628,10 @@ function getDiscordPayload(inputs) {
const repoURL = `${serverUrl}/${owner}/${repo}`;
const workflowURL = `${repoURL}/actions/runs/${runId}`;

const eventDetail = `[${payload.head_commit.author.name}](https://github.com/${actor}) authored & committed - ${payload.head_commit.message}`;
const eventDetail = payload.head_commit ?
`[${payload.head_commit.author.name}](https://github.com/${actor}) authored & committed - ${payload.head_commit.message}` :
`Action manually run by [${actor}](https://github.com/${actor})`;

const [ refs, head, branch ] = ref.split('/');

if(!inputs.status) inputs.status = DEFAULT_VALUES.status;
Expand Down Expand Up @@ -17662,11 +17665,11 @@ function getDiscordPayload(inputs) {
if (inputs.event_info) {
embed.fields = [
{ name: '', value: '', inline: false },
{ name: 'Repository', value: `[${owner}/${repo}](${repoURL})`, inline: true },
{ name: 'Branch', value: `[${branch}](${repoURL}/tree/${branch})`, inline: true },
{ name: 'Repository', value: `[\`${owner}/${repo}\`](${repoURL})`, inline: true },
{ name: 'Branch', value: `[\`${branch}\`](${repoURL}/tree/${branch})`, inline: true },
{ name: '', value: '', inline: false },
{ name: 'Commit', value: `[\`${payload.head_commit.id.substring(0, 7)}\`](${payload.head_commit.url})`, inline: true },
{ name: 'Workflow', value: `[${workflow}#${runId}](${workflowURL})`, inline: true },
{ name: 'Commit', value: payload.head_commit ? `[\`${payload.head_commit.id.substring(0, 7)}\`](${payload.head_commit.url})` : '-', inline: true },
{ name: 'Workflow', value: `[\`${workflow}#${runId}\`](${workflowURL})`, inline: true },
{ name: '', value: '', inline: false },
]
}
Expand Down
13 changes: 8 additions & 5 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ export function getDiscordPayload(inputs) {
const repoURL = `${serverUrl}/${owner}/${repo}`;
const workflowURL = `${repoURL}/actions/runs/${runId}`;

const eventDetail = `[${payload.head_commit.author.name}](https://github.com/${actor}) authored & committed - ${payload.head_commit.message}`;
const eventDetail = payload.head_commit ?
`[${payload.head_commit.author.name}](https://github.com/${actor}) authored & committed - ${payload.head_commit.message}` :
`Action manually run by [${actor}](https://github.com/${actor})`;

const [ refs, head, branch ] = ref.split('/');

if(!inputs.status) inputs.status = DEFAULT_VALUES.status;
Expand Down Expand Up @@ -58,11 +61,11 @@ export function getDiscordPayload(inputs) {
if (inputs.event_info) {
embed.fields = [
{ name: '', value: '', inline: false },
{ name: 'Repository', value: `[${owner}/${repo}](${repoURL})`, inline: true },
{ name: 'Branch', value: `[${branch}](${repoURL}/tree/${branch})`, inline: true },
{ name: 'Repository', value: `[\`${owner}/${repo}\`](${repoURL})`, inline: true },
{ name: 'Branch', value: `[\`${branch}\`](${repoURL}/tree/${branch})`, inline: true },
{ name: '', value: '', inline: false },
{ name: 'Commit', value: `[\`${payload.head_commit.id.substring(0, 7)}\`](${payload.head_commit.url})`, inline: true },
{ name: 'Workflow', value: `[${workflow}#${runId}](${workflowURL})`, inline: true },
{ name: 'Commit', value: payload.head_commit ? `[\`${payload.head_commit.id.substring(0, 7)}\`](${payload.head_commit.url})` : '-', inline: true },
{ name: 'Workflow', value: `[\`${workflow}#${runId}\`](${workflowURL})`, inline: true },
{ name: '', value: '', inline: false },
]
}
Expand Down

0 comments on commit 0cce70c

Please sign in to comment.