We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
name: Notify Slack
on: workflow_call: inputs: num_of_languages: description: 'Number of languages translated' required: true type: string tokens_count_used: description: 'Number of OpenAI tokens used in translation' required: true type: string unit_test_success: description: 'Unit test success flag' required: true type: boolean
jobs: send_slack_notification: runs-on: ubuntu-latest steps: ## 1. Validate SLACK_WEBHOOK_URL by sending a test message - name: Validate SLACK_WEBHOOK_URL run: | response=$(curl -X POST -H 'Content-type: application/json' --data '{"text":":white_check_mark: Slack webhook URL validation test."}' -o /dev/null -s -w "%{http_code}" "$SLACK_WEBHOOK_URL") if [ "$response" -ne 200 ]; then echo "::error::Invalid SLACK_WEBHOOK_URL. Received HTTP status code $response." exit 1 else echo "SLACK_WEBHOOK_URL is valid." fi env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
## 2. Send notification to Slack - name: Send Slack notification uses: 8398a7/[email protected] with: status: ${{ job.status }} text: | Babel translation complete. Number of languages translated: ${{ inputs.num_of_languages }} Tokens used: ${{ inputs.tokens_count_used }} OpenAI tokens Testing completed: ${{ inputs.unit_test_success }} env: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} if: always() # Ensure the notification is sent even if the job fails or is canceled.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
name: Notify Slack
on:
workflow_call:
inputs:
num_of_languages:
description: 'Number of languages translated'
required: true
type: string
tokens_count_used:
description: 'Number of OpenAI tokens used in translation'
required: true
type: string
unit_test_success:
description: 'Unit test success flag'
required: true
type: boolean
jobs:
send_slack_notification:
runs-on: ubuntu-latest
steps:
## 1. Validate SLACK_WEBHOOK_URL by sending a test message
- name: Validate SLACK_WEBHOOK_URL
run: |
response=$(curl -X POST -H 'Content-type: application/json'
--data '{"text":":white_check_mark: Slack webhook URL validation test."}'
-o /dev/null -s -w "%{http_code}" "$SLACK_WEBHOOK_URL")
if [ "$response" -ne 200 ]; then
echo "::error::Invalid SLACK_WEBHOOK_URL. Received HTTP status code $response."
exit 1
else
echo "SLACK_WEBHOOK_URL is valid."
fi
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
send slack-channel a notification
get num_of_languages count from init params
get tokens_count_used in translation from init params
get unit_test_success bool flag from init params
send payload to slack with:
"Babel translation complete. num_of_languages was translated. tokens_count_used openAI tokens was used. Testing completed: unit_test_success"
The text was updated successfully, but these errors were encountered: