mirror of
https://github.com/docker/docs.git
synced 2026-04-04 10:18:57 +07:00
## Description The Slack notification workflow for Desktop release notes PRs fails when the PR is opened from a fork because GitHub doesn't expose repository secrets to `pull_request` events from forks. This PR splits the workflow into two: 1. **Release Notes PR Trigger** — runs on `pull_request`, saves PR details (URL, title, author) as an artifact. No secrets needed. 2. **Notify Slack on Desktop Release Notes PR** — runs on `workflow_run` after the trigger completes, downloads the artifact, and sends the Slack notification. Has access to secrets since `workflow_run` runs in the context of the base repository. ## Related issues or tickets Fixes the `SlackError: Missing input! A token must be provided` error in the notify-release-notes-pr workflow. ## Reviews - [x] Technical review Signed-off-by: Lorena Rangel <lorena.rangel@docker.com>
46 lines
1.6 KiB
YAML
46 lines
1.6 KiB
YAML
name: Notify Slack on Desktop Release Notes PR
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ["Release Notes PR Trigger"]
|
|
types: [completed]
|
|
|
|
jobs:
|
|
notify:
|
|
runs-on: ubuntu-24.04
|
|
if: github.repository_owner == 'docker' && github.event.workflow_run.conclusion == 'success'
|
|
steps:
|
|
- name: Download PR details
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
|
|
with:
|
|
name: pr-details
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
run-id: ${{ github.event.workflow_run.id }}
|
|
|
|
- name: Read PR details
|
|
id: pr
|
|
run: |
|
|
echo "url=$(jq -r .url pr-details.json)" >> "$GITHUB_OUTPUT"
|
|
echo "title=$(jq -r .title pr-details.json)" >> "$GITHUB_OUTPUT"
|
|
echo "author=$(jq -r .author pr-details.json)" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Notify Slack
|
|
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
|
|
with:
|
|
method: chat.postMessage
|
|
token: ${{ secrets.SLACK_BOT_TOKEN }}
|
|
payload: |
|
|
{
|
|
"channel": "${{ secrets.SLACK_RELEASE_CHANNEL_ID }}",
|
|
"text": "Desktop release notes",
|
|
"blocks": [
|
|
{
|
|
"type": "section",
|
|
"text": {
|
|
"type": "mrkdwn",
|
|
"text": ":memo: *Desktop release notes*:\n<${{ steps.pr.outputs.url }}|${{ steps.pr.outputs.title }}> by <https://github.com/${{ steps.pr.outputs.author }}|${{ steps.pr.outputs.author }}>"
|
|
}
|
|
}
|
|
]
|
|
}
|