slack-github-action icon indicating copy to clipboard operation
slack-github-action copied to clipboard

Feature Request: be able to post a file to slack

Open mccare opened this issue 2 years ago • 19 comments

Description

We are using https://github.com/adrey/slack-file-upload-action to upload a file. Would be great if slackapi would also support this method.

What type of issue is this? (place an x in one of the [ ])

  • [ ] bug
  • [x] enhancement (feature request)
  • [ ] question
  • [ ] documentation related
  • [ ] example code related
  • [ ] testing related
  • [ ] discussion

mccare avatar May 02 '22 09:05 mccare

This would be great!

StefanOltmann avatar Jan 17 '23 08:01 StefanOltmann

This is the only feature that is missing for my workflow to be perfect

shalva97 avatar Feb 15 '23 13:02 shalva97

Is any verified GitHub actions tool available to send the file to Slack? We are not allowed to use unverified tools.

govindgupta1103 avatar Jun 14 '23 05:06 govindgupta1103

You can use Slack API directly for example:

      - name: Upload file to Slack
        run: >
          curl -F file=@app/build/outputs/apk/production/release/app-production-release.apk
          -F "initial_comment=Android production variant APK"
          -F channels=mobile-builds-android
          -H "Authorization: Bearer ${{ secrets.SLACK_BOT_TOKEN }}"
          https://slack.com/api/files.upload

Of course it is not perfect, but it works

shalva97 avatar Jun 14 '23 14:06 shalva97

Hi Shalva, where is the file location? Actually I want to attach an artifact which is generated using GitHub actions.

govindgupta1103 avatar Jun 14 '23 14:06 govindgupta1103

It is specified after @ symbol

curl -F [email protected]

directory will be your repository root. Check https://api.slack.com/methods/files.upload for more info

shalva97 avatar Jun 14 '23 19:06 shalva97

Hi Shalva, so does this method support only the json files or any other file type? Because I want to upload an excel file to Slack

govindgupta1103 avatar Jun 15 '23 00:06 govindgupta1103

curl -F file=@app/build/outputs/apk/production/release/app-production-release.apk

Shouldn't file be in double quotes?

govindgupta1103 avatar Jun 15 '23 05:06 govindgupta1103

Did it work for you Shelva ?

govindgupta1103 avatar Jun 15 '23 09:06 govindgupta1103

yes, thats what I use in my project. It does not need double queotes. I think its better to ask it somewhere else, because this issue is for a feature request...

shalva97 avatar Jun 15 '23 10:06 shalva97

Shalva , I know, but the requested feature is posting a file to Slack. I spent 5 hours today trying to send an excel file using above command but in vain

govindgupta1103 avatar Jun 15 '23 11:06 govindgupta1103

@srajiang Can you please confirm if we can send excel file to Slack using the commands provided by @shalva97 .

govindgupta1103 avatar Jun 15 '23 11:06 govindgupta1103

@govindgupta1103 Yes for me it is working fine sending an Excel sheet.

gauravcanon avatar Jul 22 '23 12:07 gauravcanon

For me too it worked. Thanks

On Sat, Jul 22, 2023 at 6:05 PM Gaurav Dubey @.***> wrote:

@govindgupta1103 https://github.com/govindgupta1103 Yes for me it is working fine sending an Excel sheet.

— Reply to this email directly, view it on GitHub https://github.com/slackapi/slack-github-action/issues/92#issuecomment-1646574812, or unsubscribe https://github.com/notifications/unsubscribe-auth/APQA2PFDVDSNMMYRIS3L2NTXRPCKNANCNFSM5U3OUKVQ . You are receiving this because you were mentioned.Message ID: @.***>

govindgupta1103 avatar Jul 24 '23 02:07 govindgupta1103

@seratch , I would like to contribute to this feature. can I take this up?

iamunni avatar Sep 22 '23 13:09 iamunni

I'd love to see this feature added as well. From an implementation perspective, I see it needing to be a two step process to support the nice formatting/block style messages which don't seem to be supported by the upload API (I haven't thoroughly checked this yet, though).

  1. Upload the file generically using the upload API and note the TS
  2. Update the message TS with the standard message API, thus supporting blocks.

derekmurawsky avatar Oct 12 '23 13:10 derekmurawsky

It's 2024 and this feature would be a great addition!!

mjrulesamrat avatar Apr 10 '24 06:04 mjrulesamrat

any updates

amrgetment avatar May 02 '24 15:05 amrgetment