-
Notifications
You must be signed in to change notification settings - Fork 523
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import requests | ||
import json | ||
|
||
def send_slack_message(webhook_url, message): | ||
# Define the payload to be sent to Slack | ||
payload = { | ||
"text": message | ||
} | ||
|
||
# Convert the payload to JSON | ||
payload_json = json.dumps(payload) | ||
|
||
# Send the HTTP POST request to Slack webhook URL | ||
response = requests.post(webhook_url, data=payload_json) | ||
|
||
# Check if the request was successful | ||
if response.status_code == 200: | ||
print("Message sent successfully to Slack channel!") | ||
else: | ||
print(f"Failed to send message to Slack. Status code: {response.status_code}") | ||
|
||
# Set your Slack webhook URL and message | ||
slack_webhook_url = "https://app.slack.com/client/E016WLPF0G6/C070FP6HJ2C?_gl=1*177f49f*_gcl_au*MTU2MTM4OTc3OC4xNzEzMTg3MTQx" | ||
message_to_send = "Hello from Python script!" | ||
|
||
# Call the function to send the message | ||
send_slack_message(slack_webhook_url, message_to_send) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
print_slack_message: | ||
name: ⚡ Print Slack Message ⚡ | ||
agent: | ||
type: Unity::VM | ||
image: package-ci/ubuntu:stable | ||
flavor: b1.large | ||
commands: | ||
- command: |- | ||
sudo apt install -y python3-pip | ||
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg | ||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null | ||
sudo apt -y update | ||
sudo apt -y install gh | ||
timeout: 5 | ||
retries: 5 | ||
- command: pip install unity-downloader-cli --upgrade --index-url https://artifactory.prd.it.unity3d.com/artifactory/api/pypi/pypi/simple | ||
- command: npm install upm-ci-utils@stable -g --registry https://artifactory.prd.cds.internal.unity3d.com/artifactory/api/npm/upm-npm | ||
- command: unity-downloader-cli -u trunk -c editor --wait --fast | ||
- command: upm-ci package test -u .Editor --enable-code-coverage --code-coverage-options "generateAdditionalMetrics;generateHtmlReport;assemblyFilters:{% for assembly in code_coverage_assemblies -%}+{{ assembly }},{% endfor -%};" --extra-utr-arg=--coverage-results-path=$YAMATO_SOURCE_DIR/upm-ci~/test-results/CoverageResults | ||
timeout: 5 | ||
retries: 5 | ||
- command: |- | ||
echo # Print Slack Message | ||
python .yamato/print_message_slack_channel.py | ||
artifacts: | ||
logs: | ||
paths: | ||
- "upm-ci~/test-results/**/*" | ||
dependencies: | ||
- .yamato/package-pack.yml#pack |