Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SLACK_THREAD_TS not working or needs better documentation #210

Open
kishore-vkrn opened this issue Nov 25, 2024 · 2 comments · May be fixed by #212
Open

SLACK_THREAD_TS not working or needs better documentation #210

kishore-vkrn opened this issue Nov 25, 2024 · 2 comments · May be fixed by #212

Comments

@kishore-vkrn
Copy link

kishore-vkrn commented Nov 25, 2024

Hi,

From README for variable SLACK_THREAD_TS I got

If you want to send message in a thread, you can pass the timestamp of the parent message to this variable. You can get the timestamp of the parent message from the message URL in Slack. (ex: SLACK_THREAD_TS: 1586130833.000100)

But still not clear how would I get the timestamp of the parent mesage. Looking at slack api ts seems a better output but when I tried I get separate messages not in threads

jobs:
  send-slack-notification:
    runs-on: [ Standard, self-hosted, X64, ubuntu ]
    needs: [validate-inputs]
    steps:
      - name: Notify Slack - Deployment Started
        id: slack-notify
        uses: actions/action-slack-notify@v2.2.1
        if: always()
        env:
          SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
          SLACK_MESSAGE: "*» ${{ github.event.inputs.env }}* deployment started. _${{ github.event.inputs.tag }}_"
          MSG_MINIMAL: actions url, commit
          SLACK_FOOTER: ""
          SLACK_COLOR: ${{ job.status }} 
          
  ec2-deployment:
    needs: [send-slack-notification]
    runs-on: [ Standard, self-hosted, X64, ubuntu ]
    steps:
      - name: Notify Slack - Deployment status
        uses: actions/action-slack-notify@v2.2.1
        if: always()
        env:
          SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
          MSG_MINIMAL: actions url, commit
          SLACK_MESSAGE: "*» ${{ github.event.inputs.env }}*. deployment status  → ${{ job.status }}"
          SLACK_FOOTER: ""
          SLACK_COLOR: ${{ job.status }}
          SLACK_THREAD_TS: "${{ needs.slack-notify.outputs.ts }}"

Better documentation or on how to use this will be appreciated.

@kishore-vkrn kishore-vkrn changed the title SLACK_THREAD_TS not working SLACK_THREAD_TS not working or needs better documentation Nov 25, 2024
@albertoxamin
Copy link

Looks like there was a PR that was setting the output_ts but its not in the merged code cc. @L0RD-ZER0
https://github.com/rtCamp/action-slack-notify/pull/73/files#diff-2873f79a86c0d8b3335cd7731b0ecf7dd4301eb19a82ef7a1cba7589b5252261R254-R262

@MishaKav
Copy link

MishaKav commented Dec 9, 2024

any updates? the output for ts maybe very useful.

albertoxamin added a commit to albertoxamin/action-slack-notify that referenced this issue Dec 10, 2024
Fixes rtCamp#210

Add support for `SLACK_THREAD_TS` variable and improve documentation.

* Add `outputs` section in `action.yml` to include `ts` output.
* Set `ts` output after sending the Slack message in `main.go`.
* Add a function to extract the `ts` value from the Slack response in `main.go`.
* Handle the `SLACK_THREAD_TS` variable in `entrypoint.sh` and `main.sh`.
* Improve documentation in `README.md` on how to obtain the timestamp of the parent message.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/rtCamp/action-slack-notify/issues/210?shareId=XXXX-XXXX-XXXX-XXXX).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants