我添加了 github 操作,该操作在每次发布时都会在我们的 slack 频道上发送消息。
我已经设法从 github context 获取 repo 名称和标签,但我也在尝试并且未能在该消息中获取发布标题和发布说明。我试过这些组合:
${{ github.event.payload.release.name || github.event.payload.release || github.event.payload }}
有谁知道如何解决这个问题?
name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Sbt
uses: olafurpg/setup-scala@v10
- name: Set library version
run: ./sbt dynver
- name: Publish stable version
run: ./sbt publish
env:
JFROG_PASSWORD: ${{ secrets.JFROG_PASSWORD }}
- name: Post to a Slack channel
id: slack
uses: slackapi/slack-github-action@v1.17.0
with:
channel-id: 'releases'
slack-message: "Release result: ${{ job.status }}\n${{ github.repository }}: ${{ github.ref_name }}\nRelease info: ${{ github.event.payload.release.name }}, ${{ github.event.payload.release }} ${{ github.event.payload }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}