tokorom / action-slack-incoming-webhook Goto Github PK
View Code? Open in Web Editor NEWGitHub Action for Slack Incoming Webhook
License: MIT License
GitHub Action for Slack Incoming Webhook
License: MIT License
Issue scenario:
Am using the below code to trap a release and then send a slack notification and am getting error "Error: Request failed with status 400". The notification works for every other event like deployment created, succeeded etc, except for release published. This used to work, and has broken in the 2 months or so. I strongly believe that this is a GITHUB issue as this error doesnt occur if I create a release manually from github portal. When I create a release from github code shown below, the error from slack .
I will open a case with Git and see how it goes and update here.
- name: Release Published
if: github.event_name == 'release' && github.event.action == 'released'
uses: tokorom/action-slack-incoming-webhook@master
env:
INCOMING_WEBHOOK_URL: ${{env.SLACK_CHANNEL_WEBHOOK}}
TITLE: ":loudspeaker: *<${{github.event.release.html_url}}|${{github.event.repository.name}} ${{github.event.release.tag_name}}>* is ready for verification testing."
BODY: "*${{github.event.release.name}} Release Notes*\n${{github.event.release.body}}"
BUTTON: "Open ${{github.event.release.tag_name}}"
URL: ${{github.event.release.html_url}}
FOOTER: ":information_source: *<${{ github.event.repository.html_url }}|${{github.event.repository.name}} repository>*"
with:
text: "CHAdminTable Production Released"
- shell: pwsh
name: Get the app version from chart.yml
run: |
$RELEASE_NUMBER = (get-content .\charts\Metricon.ClickHome.AdminTables.Web\Chart.yaml| ConvertFrom-Yaml | Select version).version
Write-Output "::set-env name=RELEASE_NUMBER::$RELEASE_NUMBER"
$env:ReleaseNotes | out-file releasenotes.txt
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
GITHUB_TOKEN: ${{ env.Password }}
with:
tag_name: ${{ env.RELEASE_NUMBER }}
release_name: ${{ env.RELEASE_NUMBER }}
body_path: releasenotes.txt
draft: true
prerelease: false
#echo "RELEASE_NUMBER=$RELEASE_NUMBER" >> $GITHUB_ENV - this isnt working.
#https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions
After running action, I see warning:
Warning: The
set-output command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
Will be PR for this?
Thanks!
Hello.
I could not notify with Attachments / Block to Slack.
When I use Attachments like this, It will only appear as shown in the photo below.
...
- name: Slack Incoming Webhook
if: success()
uses: tokorom/[email protected]
env:
INCOMING_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
text: This is test.
attachments: |
[
{
"color": "good",
"author_name": "${{ github.actor }}",
"author_icon": "${{ github.event.sender.avatar_url }}",
"fields": [
{
"title": "GitHub Actions URL",
"value": "${{ github.event.repository.url }}/actions/runs/${{ github.run_id }}"
}
]
}
]
Also, I use Block payload like this.
I could not catch the notify.
# Slack notify
- name: Slack Incoming Webhook
if: success()
uses: tokorom/[email protected]
env:
INCOMING_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
blocks: |
[
{
"type": "section",
"text": {
"type": "plain_text",
"text": "ブログの更新が完了したよ!",
"emoji": true
}
},
{
"type": "divider"
},
{
"type": "context",
"elements": [
{
"type": "image",
"image_url": "${{ github.event.sender.avatar_url }}",
"alt_text": "github avatar"
},
{
"type": "mrkdwn",
"text": ": ${{ github.actor }}"
}
]
},
{
"type": "context",
"elements": [
{
"type": "plain_text",
"text": "Commit Message :",
"emoji": true
}
]
},
{
"type": "context",
"elements": [
{
"type": "plain_text",
"text": "GitHub Actions URL :"
},
{
"type": "mrkdwn",
"text": "${{ github.event.repository.url }}/actions/runs/${{ github.run_id }}"
}
]
}
]
I want to solve problem because I want to use this package to notify my Slack.
I have no idea to solve this problem. Plz give me an idea.
Thank you :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.