Skip to content

Commit

Permalink
Switch between regular and scheduled channel
Browse files Browse the repository at this point in the history
  • Loading branch information
joernott committed Aug 14, 2024
1 parent 4aab914 commit 9d9660e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 14 deletions.
24 changes: 17 additions & 7 deletions .github/workflows/universal_workflow_light.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ on:
description: 'Content of ~/oxid-esales/_custom.yaml'
default: ''
required: false
custom_slack_channel:
type: string
description: 'Custom slack channel to override the default'
default: ''
use_scheduled_slack_channel:
type: boolean
description: 'Use alternative slack channel'
default: false
required: false

secrets:
Expand Down Expand Up @@ -71,6 +71,9 @@ on:
SLACK_WEBHOOK_URL:
required: false
# description: Webhook for posting to SLACK
SLACK_SCHEDULED_WEBHOOK_URL:
required: false
# description: Webhook for posting to SLACK

jobs:
init:
Expand Down Expand Up @@ -1304,15 +1307,22 @@ jobs:
- yamllint
- actionlint
runs-on: ${{ fromJSON(inputs.runs_on) }}
env:
SLACK_WEBHOOK: "${{ inputs.custom_slack_channel || secrets.SLACK_WEBHOOK_URL }}"
steps:
- name: Choose Slack channel
id: slack
shell: bash
run: |
if [ "${{ inputs.use_scheduled_slack_channel }}" == "false" ]; then
echo "webhook=${{ secrets.SLACK_WEBHOOK_URL }}" >>"${GITHUB_OUTPUT}"
else
echo "webhook=${{ secrets.SLACK_SCHEDULED_WEBHOOK_URL }}" >>"${GITHUB_OUTPUT}"
fi
- name: 'Generate report'
id: generate_report
uses: 'OXID-eSales/github-actions/generate_report@v4'
with:
prefix: '${{ needs.init.outputs.global_title }}'
slack_webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
slack_webhook: ${{ steps.slack.outputs.webhook }}
title: '${{ needs.init.outputs.finish_slack_title }}'
compact: '${{ needs.init.outputs.finish_slack_compact }}'
debug: ${{ inputs.debug }}
Expand Down
24 changes: 17 additions & 7 deletions .github/workflows/universal_workflow_light.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ on:
description: 'Content of ~/oxid-esales/_custom.yaml'
default: ''
required: false
custom_slack_channel:
type: string
description: 'Custom slack channel to override the default'
default: ''
use_scheduled_slack_channel:
type: boolean
description: 'Use alternative slack channel'
default: false
required: false

secrets:
Expand Down Expand Up @@ -71,6 +71,9 @@ on:
SLACK_WEBHOOK_URL:
required: false
# description: Webhook for posting to SLACK
SLACK_SCHEDULED_WEBHOOK_URL:
required: false
# description: Webhook for posting to SLACK

jobs:
init:
Expand Down Expand Up @@ -1304,15 +1307,22 @@ jobs:
- yamllint
- actionlint
runs-on: ${{ fromJSON(inputs.runs_on) }}
env:
SLACK_WEBHOOK: "${{ inputs.custom_slack_channel || secrets.SLACK_WEBHOOK_URL }}"
steps:
- name: Choose Slack channel
id: slack
shell: bash
run: |
if [ "${{ inputs.use_scheduled_slack_channel }}" == "false" ]; then
echo "webhook=${{ secrets.SLACK_WEBHOOK_URL }}" >>"${GITHUB_OUTPUT}"
else
echo "webhook=${{ secrets.SLACK_SCHEDULED_WEBHOOK_URL }}" >>"${GITHUB_OUTPUT}"
fi
- name: 'Generate report'
id: generate_report
uses: 'OXID-eSales/github-actions/generate_report@v4'
with:
prefix: '${{ needs.init.outputs.global_title }}'
slack_webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
slack_webhook: ${{ steps.slack.outputs.webhook }}
title: '${{ needs.init.outputs.finish_slack_title }}'
compact: '${{ needs.init.outputs.finish_slack_compact }}'
debug: ${{ inputs.debug }}
Expand Down

0 comments on commit 9d9660e

Please sign in to comment.