From 17844871dd9262cd99194a2fc204010f07761237 Mon Sep 17 00:00:00 2001 From: yaythomas Date: Thu, 14 May 2026 08:35:54 +0000 Subject: [PATCH] chore: split notify_slack into separate workflows - notify-issues.yml: issue notifications - notify-pr.yml: pull request notifications - notify-release.yml: callable workflow for release notifications - pypi-publish.yml: call notify-release after successful publish --- .github/workflows/notify-issues.yml | 23 ++++++++++++++++ .github/workflows/notify-pr.yml | 24 +++++++++++++++++ .github/workflows/notify-release.yml | 29 +++++++++++++++++++++ .github/workflows/notify_slack.yml | 39 ---------------------------- .github/workflows/pypi-publish.yml | 8 ++++++ 5 files changed, 84 insertions(+), 39 deletions(-) create mode 100644 .github/workflows/notify-issues.yml create mode 100644 .github/workflows/notify-pr.yml create mode 100644 .github/workflows/notify-release.yml delete mode 100644 .github/workflows/notify_slack.yml diff --git a/.github/workflows/notify-issues.yml b/.github/workflows/notify-issues.yml new file mode 100644 index 0000000..c4d8965 --- /dev/null +++ b/.github/workflows/notify-issues.yml @@ -0,0 +1,23 @@ +name: Notify Slack - Issues + +on: + issues: + types: [opened, reopened] + +permissions: {} + +jobs: + notify: + runs-on: ubuntu-latest + steps: + - name: Send issue notification to Slack + uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3 + with: + webhook: ${{ secrets.SLACK_WEBHOOK_URL_ISSUE }} + webhook-type: incoming-webhook + payload: | + { + "action": "${{ github.event.action }}", + "issue_url": "${{ github.event.issue.html_url }}", + "package_name": "${{ github.repository }}" + } diff --git a/.github/workflows/notify-pr.yml b/.github/workflows/notify-pr.yml new file mode 100644 index 0000000..0335e6a --- /dev/null +++ b/.github/workflows/notify-pr.yml @@ -0,0 +1,24 @@ +name: Notify Slack - Pull Requests + +on: + pull_request_target: + types: [opened, reopened, ready_for_review] + +permissions: {} + +jobs: + notify: + runs-on: ubuntu-latest + steps: + - name: Send pull request notification to Slack + if: github.event.pull_request.draft == false + uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3 + with: + webhook: ${{ secrets.SLACK_WEBHOOK_URL_PR }} + webhook-type: incoming-webhook + payload: | + { + "action": "${{ github.event.action }}", + "pr_url": "${{ github.event.pull_request.html_url }}", + "package_name": "${{ github.repository }}" + } diff --git a/.github/workflows/notify-release.yml b/.github/workflows/notify-release.yml new file mode 100644 index 0000000..778db7e --- /dev/null +++ b/.github/workflows/notify-release.yml @@ -0,0 +1,29 @@ +name: Notify Slack - Release + +on: + workflow_call: + inputs: + tag_name: + required: true + type: string + release_url: + required: true + type: string + +permissions: {} + +jobs: + notify: + runs-on: ubuntu-latest + steps: + - name: Send release notification to Slack + uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3 + with: + webhook: ${{ secrets.SLACK_WEBHOOK_URL_RELEASE }} + webhook-type: incoming-webhook + payload: | + { + "tag_name": "${{ inputs.tag_name }}", + "release_url": "${{ inputs.release_url }}", + "package_name": "${{ github.repository }}" + } diff --git a/.github/workflows/notify_slack.yml b/.github/workflows/notify_slack.yml deleted file mode 100644 index be4bdee..0000000 --- a/.github/workflows/notify_slack.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Slack Notifications - -on: - issues: - types: [opened, reopened] - pull_request_target: - types: [opened, reopened, ready_for_review] - -permissions: {} - -jobs: - notify: - runs-on: ubuntu-latest - steps: - - name: Send issue notification to Slack - if: github.event_name == 'issues' - uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3 - with: - webhook: ${{ secrets.SLACK_WEBHOOK_URL_ISSUE }} - webhook-type: incoming-webhook - payload: | - { - "action": "${{ github.event.action }}", - "issue_url": "${{ github.event.issue.html_url }}", - "package_name": "${{ github.repository }}" - } - - - name: Send pull request notification to Slack - if: github.event_name == 'pull_request_target' && github.event.pull_request.draft == false - uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3 - with: - webhook: ${{ secrets.SLACK_WEBHOOK_URL_PR }} - webhook-type: incoming-webhook - payload: | - { - "action": "${{ github.event.action }}", - "pr_url": "${{ github.event.pull_request.html_url }}", - "package_name": "${{ github.repository }}" - } \ No newline at end of file diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 6d172c8..e0e0a2b 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -69,3 +69,11 @@ jobs: uses: pypa/gh-action-pypi-publish@cef221092ed1bacb1cc03d23a2d87d1d172e277b # v1.14.0 with: packages-dir: dist/ + + notify-release: + needs: [pypi-publish] + uses: ./.github/workflows/notify-release.yml + with: + tag_name: ${{ github.event.release.tag_name }} + release_url: ${{ github.event.release.html_url }} + secrets: inherit