abinoda / slack-action

GitHub Action for posting Slack messages
MIT License
270 stars 37 forks source link

Shell problem in entrypoint file (?) #7

Open chapati23 opened 5 years ago

chapati23 commented 5 years ago

Followed the README, and it doesn't work for me, here's the problem:

image

Link to failing job: https://github.com/chapati23/hello-github-actions/pull/4/checks#step:3:7

My job code is as follows:

jobs:
  slack-notifier:
    runs-on: ubuntu-latest
    steps:
      - name: Notify slack
        env:
          SLACK_BOT_TOKEN: ${{secrets.SLACK_BOT_TOKEN}}
        uses: pullreminders/slack-action@master
        with:
          args: '{\"channel\":\"D790ZUYJH\",\"text\":\"Hello world\"}'

Not 100% sure but this looks like some shell/bash syntax issue.

Any idea what's going wrong here?

chapati23 commented 5 years ago

Ok, partly my stupidity for not noticing that it is indeed working, i just tried to use a DM ID which doesn't seem to work. public channel ID did the trick.

however, still doesn't explain the weird shell warning

fullstackfool commented 4 years ago

Getting this and using a public ID

EDIT: Didn't read the error properly, apologies. It was a scope issue with the OATH

StianOvrevage commented 4 years ago

Have problems with the Oauth scopes. But this false-positive error message should be fixed to avoid confusion.

saintfirewater commented 4 years ago

I get the exactly same problem, and I don't use channel ID because the channel is private. How could I solve it?

This is my yml code.

jobs:
  # start deployment
  notify_start:
    name: notify deployment start
    runs-on: ubuntu-latest
    steps:
      - name: start
        env: 
          SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
        uses: pullreminders/slack-action@master
        with:
          args: '{
            \"text\": \"start deployment\",
          }'
StianOvrevage commented 4 years ago

I just reverted to using plain curl which is almost as simple but avoids the new abstraction/indirection of this slack-action:

    - name: Notify slack
      if: github.ref == 'refs/heads/develop'
      env:
        SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
      run: |
        curl -X POST \
          -H "Content-type: application/json" \
          -H "Authorization: Bearer $SLACK_BOT_TOKEN" \
          -d '{"channel":"XXXXXXX","text":"Re-deployed development environment"}' \
          https://slack.com/api/chat.postMessage

Remember to replace the Channel ID. You find it in the URL when using Slack in the browser.

robpc commented 4 years ago

I ran into this issue as well and created a PR https://github.com/pullreminders/slack-action/pull/16