Skip to content

Commit

Permalink
Customization of the channel where build failures are notified (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris-V authored Jul 4, 2024
1 parent f767417 commit 08c09bf
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 22 deletions.
48 changes: 30 additions & 18 deletions .github/workflows/php-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ on:
description: 'Array of paths to skip for the frontend'
required: false
type: string
slack-channel:
description: |
The Slack channel where the notification will be sent.
Defaults to $ {{ github.event.repository.custom_properties.ci_slack_channel }}.
required: false
type: string
update-wsdl:
default: false
description: 'If true, runs UpdateWSDL tool.'
Expand Down Expand Up @@ -144,8 +150,8 @@ on:
SENTRY_ORG:
description: 'Sentry organization'
required: false
SLACK_NOTIFICATION_WEBHOOK_URL:
description: A Slack webhook where workflow failures will be published to.
SLACK_BOT_TOKEN:
description: The bot token used to authenticate with Slack.
required: true

env:
Expand Down Expand Up @@ -899,23 +905,29 @@ jobs:
name: Notify
runs-on: ubuntu-latest
needs:
- psalm
- phpunit
- phpunit-it
- phpcs
- generate_sdk
- eslint
- stylelint
- js-tests
- yaml_validate
- build_backend
- build_frontend
- image
- createSentryRelease
if: failure() && github.event_name == 'push'
- pre-checks
- setup
- phpunit
- phpunit-it
- psalm
- phpcs
- eslint
- stylelint
- js-tests
- yaml_validate
- build_backend
- build_frontend
- image
- docker-security
- openapi_yaml
- generate_sdk
- createSentryRelease
if: always() && github.event_name == 'push'
steps:
- name: Post workflow status
uses: equisoft-actions/notify-workflow-status@v1
uses: equisoft-actions/notify-workflow-status@v2
with:
needs: ${{ toJSON(needs) }}
slack-webhook-url: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK_URL }}
downgrade-to-warning: docker-security,generate_sdk
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: ${{ inputs.slack-channel || github.event.repository.custom_properties.ci_slack_channel }}
18 changes: 14 additions & 4 deletions .github/workflows/php-library.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,19 @@ on:
default: '--no-cache --no-diff'
required: false
type: string
slack-channel:
description: |
The Slack channel where the notification will be sent.
Defaults to $ {{ github.event.repository.custom_properties.ci_slack_channel }}.
required: false
type: string
secrets:
GPR_KEY:
description: Personal access token to fetch private repos
required: false
SLACK_BOT_TOKEN:
description: The bot token used to authenticate with Slack.
required: true

env:
php-cache-key: v1
Expand Down Expand Up @@ -171,14 +180,15 @@ jobs:
name: Notify
runs-on: ubuntu-latest
needs:
- psalm
- phpunit
- psalm
- phpcs
- qodana
if: failure() && github.event_name == 'push'
if: always() && github.event_name == 'push'
steps:
- name: Post workflow status
uses: equisoft-actions/notify-workflow-status@v1
uses: equisoft-actions/notify-workflow-status@v2
with:
needs: ${{ toJSON(needs) }}
slack-webhook-url: ${{ secrets.OPS_CI_WEBHOOK_URL }}
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
slack-channel: ${{ inputs.slack-channel || github.event.repository.custom_properties.ci_slack_channel }}

0 comments on commit 08c09bf

Please sign in to comment.