This action uploads file(s) to slack using v2 files API.
Required Slack app token. See Internal app tokens
- Create app
- Add
files:write
andfiles:read
permission - Install app to your workspase
- Invite bot to required channels
/invite <botname>
- Use bot token from
OAuth & Permissions
page
Required List of files including file path and filename remember json wont
work with backslashes so you might need ${{ toJSON(variable) }}
THIS IS NOT A CHANNEL NAME Slack channel ID for upload
ID is included in the URL of a channel in web version.
Slack thread for upload
The message text introducing the file in specified channels.
on: [push]
jobs:
slack_upload_job:
runs-on: ubuntu-latest
name: Upload test file
steps:
- name: Checkout
uses: actions/checkout@v4
- run: |
mkdir dir
echo "Test file " > dir/test.txt
- name: Upload to slack step
uses: vaporif/slack-file-upload-action@v1
with:
token: ${{ secrets.SLACK_TOKEN }}
files: >
[
{"file": "./dir/test.txt", "filename": "testfile.txt"},
{"file": "./dir/test.txt", "filename": "testfile.txt"}
]
channel_id: C06S5FLDSN4