diff --git a/deploy-slack-action/action.yml b/deploy-slack-action/action.yml index fa8107f8..87d085cc 100644 --- a/deploy-slack-action/action.yml +++ b/deploy-slack-action/action.yml @@ -9,6 +9,8 @@ inputs: required: true mention-person: description: "User to mention in message" + author: + description: "Override the GitHub actor (for dispatched workflows)" status: description: 'Status of the deployment [start, done, request, success, cancelled, failure]' default: 'start' @@ -29,5 +31,6 @@ runs: slack-api-token: ${{ inputs.slack-api-token }} channel: ${{ inputs.channel }} mention-person: ${{ inputs.mention-person }} + author: ${{ inputs.author }} status: ${{ inputs.status }} extras: nope \ No newline at end of file diff --git a/helper-slack-action/action.yml b/helper-slack-action/action.yml index af7ff80b..64564d4f 100644 --- a/helper-slack-action/action.yml +++ b/helper-slack-action/action.yml @@ -12,6 +12,8 @@ inputs: required: true mention-person: description: "User to mention in message" + author: + description: "Override the GitHub actor (for dispatched workflows)" status: description: "Status of run [start, done, request]" default: "start" diff --git a/slack-javascript-action/dist/deploy/index.js b/slack-javascript-action/dist/deploy/index.js index 3032dad1..fcbbea60 100644 --- a/slack-javascript-action/dist/deploy/index.js +++ b/slack-javascript-action/dist/deploy/index.js @@ -579,10 +579,15 @@ const getReleaseNotes = (githubContext) => { } return "no release notes"; }; -const getAuthor = (githubContext) => githubContext.event.release && - !githubContext.event.release.author.login.includes("github-actions") - ? githubContext.event.release.author.login - : githubContext.actor; +const getAuthor = (githubContext) => { + const authorOverride = (0, core_1.getInput)("author"); + if (authorOverride) + return authorOverride; + return githubContext.event.release && + !githubContext.event.release.author.login.includes("github-actions") + ? githubContext.event.release.author.login + : githubContext.actor; +}; const getDateTime = () => { return Intl.DateTimeFormat("en", { timeZone: "America/Chicago", diff --git a/slack-javascript-action/src/useConfig.ts b/slack-javascript-action/src/useConfig.ts index 539ef9e0..dd70bec4 100644 --- a/slack-javascript-action/src/useConfig.ts +++ b/slack-javascript-action/src/useConfig.ts @@ -61,11 +61,15 @@ const getReleaseNotes = (githubContext: GithubContextType): string => { return "no release notes"; }; -const getAuthor = (githubContext: GithubContextType): string => - githubContext.event.release && - !githubContext.event.release.author.login.includes("github-actions") +const getAuthor = (githubContext: GithubContextType): string => { + const authorOverride = getInput("author"); + if (authorOverride) return authorOverride; + + return githubContext.event.release && + !githubContext.event.release.author.login.includes("github-actions") ? githubContext.event.release.author.login : githubContext.actor; +}; const getDateTime = (): string => { return Intl.DateTimeFormat("en", {