name: Slack
on:
workflow_dispatch:
inputs:
message:
description: 'post message as text file to slack'
required: true
default: 'Hello World!'
jobs:
post:
runs-on: ubuntu-latest
steps:
- run: 'echo ${{ github.event.inputs.message }} > message.txt'
- uses: MeilCli/slack-upload-file@v2
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
channels: ${{ secrets.SLACK_CHANNELS }}
file_path: 'message.txt'
file_type: 'text'
initial_comment: 'post by slack-upload-file'
You can also pin to a specific release version in the format @v2.x.x
- This action execute simply files.upload, and can upload multiple files by glob pattern
- How get slack token? see Basic app setup
- How choose Oauth Scope? This action require only
files:write
. In simply case, you do choosefiles:write
Bot Token Scope.
slack_token
- required
- Slack token, must has files:write permission
slack_api_url
- Custom slack api url
channels
- Comma-separated list of channel names or IDs where the file will be shared.
content
- File contents via a POST variable. If omitting this parameter, you must provide a
file
.
- File contents via a POST variable. If omitting this parameter, you must provide a
file_path
- File contents via multipart/form-data. If omitting this parameter, you must submit
content
. - You can use glob pattern
- File contents via multipart/form-data. If omitting this parameter, you must submit
file_path_follow_symbolic_links
- Indicates whether to follow symbolic links
- This parameter only use glob pattern
- default: true
file_name
- Filename of file.
- This parameter can only use providing
content
file_type
- A file type identifier.
- ref: https://api.slack.com/types/file#file_types
initial_comment
- The message text introducing the file in specified channels.
thread_ts
- Provide another message's ts value to upload this file as a reply. Never use a reply's ts value; use its parent instead.
title
- Title of file.
retries
- max API retry count. default retries is 3.
response
- the api response
jobs:
post:
runs-on: ubuntu-latest
steps:
- run: 'echo ${{ github.event.inputs.message }} > message.txt'
- uses: MeilCli/slack-upload-file@v2
id: message
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
channels: ${{ secrets.SLACK_CHANNELS }}
file_path: 'message.txt'
file_type: 'text'
initial_comment: 'post by slack-upload-file'
- run: 'echo ${{ fromJson(steps.message.outputs.response).file.permalink }}'
see Contributing.md
- actions/toolkit, published by MIT License
- slackapi/node-slack-sdk, published by MIT License