jobs:
post:
runs-on: ubuntu-latest
steps:
- uses: MeilCli/slack-upload-file@v3
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
channel_id: ${{ secrets.SLACK_CHANNEL_ID }}
file_path: 'docs/*.txt'
initial_comment: 'post by slack-upload-file'
# thread_ts: 'option'
jobs:
post:
runs-on: ubuntu-latest
steps:
- uses: MeilCli/slack-upload-file@v3
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
channel_id: ${{ secrets.SLACK_CHANNEL_ID }}
content: 'file content'
file_type: 'text'
file_name: 'text.txt'
title: 'title of file'
initial_comment: 'post by slack-upload-file'
# thread_ts: 'option'
- 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
files:read
andfiles:write
. In simply case, you do choosefiles:read
andfiles:write
Bot Token Scope. - Why use
files:read
Oauth scope? Because this action use files.uploadv2, and its api requiresfiles:read
. - You can also pin to a specific release version in the format
@v3.x.x
slack_token
- required
- Slack token, must has files:write permission
slack_api_url
- Custom slack api url
channel_id
- Slack channel id
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
if_no_files_found
- file not founding options: warn, error or ignore. alike actions/upload-artifact
warn
: output warning, but do not failignore
: no output and do not failerror
: output warning and do fail- default: error
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.
- links might not work because files.uploadv2 limitation. ref: #695
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.
delete_file_ids_before_upload
- file deletion before upload. comma separeted file ids. this argument is purpose for previous uploaded file replacement.
response
- the api response
- json structure: Summary of response
uploaded_file_ids
- comma separeted uploaded file ids
jobs:
post:
runs-on: ubuntu-latest
steps:
- run: 'echo ${{ github.event.inputs.message }} > message.txt'
- uses: MeilCli/slack-upload-file@v3
id: message
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
channel_id: ${{ secrets.SLACK_CHANNEL_ID }}
file_path: 'message.txt'
initial_comment: 'post by slack-upload-file'
- run: 'echo ${{ fromJson(steps.message.outputs.response).files[0].file.permalink }}'
- Must: add
files:read
permission scope to Slack App. - Need: change to
channel_id
fromchannels
.channels
is removed because it is deprecated. - Some: change some input and output.
- input:
- new:
delete_file_id_before_upload
, old:delete_file_id_before_upload
title
is changed, it will not send when upload by files.
- new:
- output:
- new:
uploaded_file_ids
, old:uploaded_file_id
response
is changed.
- new:
- input:
see Contributing.md
- actions/toolkit, published by MIT License
- slackapi/node-slack-sdk, published by MIT License