-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check for notification script to element
- Loading branch information
Showing
5 changed files
with
95 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
# helper functions | ||
log_error() { | ||
echo -e "\e[31m$1\e[0m" | ||
} | ||
|
||
log_info() { | ||
echo -e "\e[37m$1\e[0m" | ||
} | ||
|
||
log_success() { | ||
echo -e "\e[32m$1\e[0m" | ||
} | ||
|
||
sudo apt-get install jq -y | ||
response=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ | ||
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/actions/runs/$RUN_ID/jobs") | ||
|
||
|
||
if [[ "$response" != *"jobs"* ]]; then | ||
log_error "No jobs found in the below response!" | ||
log_info "$response" | ||
exit 1 | ||
fi | ||
|
||
jobs_informations=$(echo "$response" | jq '.jobs[:-1]') | ||
jobs_conclusions=$(echo "$jobs_informations" | jq -r '.[].conclusion') | ||
|
||
workflow_status="Success" | ||
if [[ " ${jobs_conclusions[*]} " == *"failure"* ]]; then | ||
workflow_status="Failure" | ||
fi | ||
|
||
send_message_to_room_response=$(curl -XPOST -d '{"msgtype": "m.text","body": "", "format": "org.matrix.custom.html","formatted_body": "<a href='https://github.com/nextcloud/integration_openproject/actions/runs/$RUN_ID'>NC-Nightly-'$BRANCH_NAME'</a><br></br><b><i>Status: '$workflow_status'</i></b>"}' "https://matrix.openproject.org/_matrix/client/r0/rooms/%21$E_ROOM_ID/send/m.room.message?access_token=$U_TOKEN") | ||
|
||
if [[ "$send_message_to_room_response" != *"event_id"* ]]; then | ||
log_error "Failed to send message to element. Below response did not contain event_id!" | ||
log_info "$send_message_to_room_response" | ||
exit 1 | ||
fi | ||
|
||
log_success "Notification of the nightly build has been sent to Element chat (OpenProject + Nextcloud)" |
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,24 @@ | ||
name: Filter Issues CI/CD from try_cron branch | ||
|
||
on: | ||
push: | ||
branches: try_cron | ||
pull_request: | ||
branches: try_cron | ||
# schedule: | ||
# - cron: "*/6 * * * *" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Chekout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install node required | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
|
||
- name: Install dependencies | ||
run: npm ci |
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 |
---|---|---|
@@ -1,11 +1,12 @@ | ||
name: Release Workflow | ||
# name: Release Workflow | ||
|
||
on: | ||
schedule: | ||
- cron: "*/60 * * * *" | ||
# on: | ||
# schedule: | ||
# - cron: "*/6 * * * *" | ||
|
||
jobs: | ||
try_cron: | ||
uses: ./.github/workflows/shared_steps.yml | ||
with: | ||
branch: try_cron | ||
# jobs: | ||
# try_cron: | ||
# uses: ./.github/workflows/shared_steps.yml | ||
# secrets: inherit | ||
# with: | ||
# branch: try_cron |
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