Edits history of script submission #22516 for ' Send information about approved job to channel (slack)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    import { WebClient } from "@slack/web-api";
    
    type Slack = {
      token: string;
    };
    export async function main(channel: string, slack: Slack, approvers: string[]) {
      const web = new WebClient(slack.token);
      const jobUrl = new URL(
        `/run/${Bun.env.WM_FLOW_JOB_ID}`,
        Bun.env.WM_BASE_URL,
      );
      const text = `Flow job ${jobUrl} (${Bun.env
        .WM_FLOW_PATH}) run by ${Bun.env.WM_USERNAME} was approved by ${approvers.join(
        ", ",
      )}`;
    
      await web.chat.postMessage({
        channel,
        text,
      });
    }
    

    Submitted by hugo989 6 days ago