upload file to slack action
jobs:
post:
runs-on: ubuntu-latest
steps:
- uses: MeilCli/slack-upload-file@v4
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@v4
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'
files:read
and files:write
. In simply case, you do choose files:read
and files:write
Bot Token Scope.files:read
Oauth scope? Because this action use files.uploadv2, and its api requires files:read
.
@v4.x.x
slack_token
slack_api_url
channel_id
content
file
.file_path
content
.file_path_follow_symbolic_links
if_no_files_found
warn
: output warning, but do not failignore
: no output and do not failerror
: output warning and do failfile_name
content
file_type
initial_comment
thread_ts
title
retries
delete_file_ids_before_upload
response
uploaded_file_ids
jobs:
post:
runs-on: ubuntu-latest
steps:
- run: 'echo ${{ github.event.inputs.message }} > message.txt'
- uses: MeilCli/slack-upload-file@v4
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 }}'
files:read
permission scope to Slack App.channel_id
from channels
. channels
is removed because it is deprecated.delete_file_id_before_upload
, old: delete_file_id_before_upload
title
is changed, it will not send when upload by files.uploaded_file_ids
, old: uploaded_file_id
response
is changed.see Contributing.md