Skip to content

Commit

Permalink
QA-6145 updated yml for hq and api
Browse files Browse the repository at this point in the history
  • Loading branch information
kbo001 committed Feb 27, 2024
1 parent 27acfd4 commit 4fb2206
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/hq-smoke-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ jobs:
return SLACK_WEBHOOK_URL
- name: Post to Slack channel on Failure
- name: Post to Slack channel
id: slack
uses: slackapi/[email protected]
if: ${{ success() || failure() }}
Expand Down
79 changes: 20 additions & 59 deletions .github/workflows/request_api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,68 +94,29 @@ jobs:
priority: normal


- name: Post to Slack channel for Prod
id: slack-api-prod
uses: slackapi/[email protected]
if: ${{ (github.event_name == 'repository_dispatch') && (github.event.client_payload.environment == 'production') && always() }}
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": " Hola 👋 \n*${{ github.workflow }}* were just triggered!"
}
},
{
"type": "context",
"elements": [
{
"type": "mrkdwn",
"text": "*Environment: *\n ${{ matrix.environment }} \n"
},
{
"type": "mrkdwn",
"text": " "
},
{
"type": "mrkdwn",
"text": "*Status: *\n ${{ job.status }} :x:"
}
]
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Here's the corresponding workflow execution :arrow_right::arrow_right:"
},
"accessory": {
"type": "button",
"text": {
"type": "plain_text",
"text": "View on Github",
"emoji": true
},
"value": "click_me_123",
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"action_id": "button-action",
"style": "danger"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_PROD_RESULTS }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: Set slack vars
if: ${{ always() }}
id: configure_slack
uses: actions/github-script@v6
env:
JOB_STATUS: ${{ job.status }}
CC_ENV: ${{ matrix.environment }}
with:
result-encoding: string
script: |
const {CC_ENV, JOB_STATUS} = process.env
let SLACK_WEBHOOK_URL = '${{ secrets.SLACK_WEBHOOK_URL_SMOKE }}'
if (context.event_name == 'repository_dispatch' && CC_ENV == 'production') {
SLACK_WEBHOOK_URL = '${{ secrets.SLACK_WEBHOOK_URL_PROD_RESULTS }}'
}
return SLACK_WEBHOOK_URL
- name: Post to Slack channel for Staging
- name: Post to Slack channel
id: slack-api-staging
uses: slackapi/[email protected]
if: ${{(github.event_name != 'repository_dispatch' && github.event.client_payload.environment == 'production') || (github.event.client_payload.environment == 'staging') && failure() }}
if: ${{ matrix.environment == 'production' || failure() }}
with:
payload: |
{
Expand Down Expand Up @@ -206,7 +167,7 @@ jobs:
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL_SMOKE }}
SLACK_WEBHOOK_URL: ${{ steps.conigure_slack.outputs.result }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

- name: Archive test results
Expand Down

0 comments on commit 4fb2206

Please sign in to comment.