diff --git a/.github/scripts/notify.sh b/.github/scripts/notify.sh
new file mode 100755
index 0000000..447059a
--- /dev/null
+++ b/.github/scripts/notify.sh
@@ -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": "NC-Nightly-'$BRANCH_NAME'
Status: '$workflow_status'"}' "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)"
diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml
new file mode 100644
index 0000000..dca8c80
--- /dev/null
+++ b/.github/workflows/actions.yml
@@ -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
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index fd27e29..7c46635 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -7,16 +7,12 @@ on:
pull_request:
branches:
- main
- schedule:
- - cron: "*/6 * * * *"
- workflow_run:
- workflows:
- - "Name of Your Workflow"
- types:
- - completed
+ # schedule:
+ # - cron: "*/6 * * * *"
jobs:
main:
uses: ./.github/workflows/shared_steps.yml
+ secrets: inherit
with:
branch: main
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 8ac2529..8d2fd32 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -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
diff --git a/.github/workflows/shared_steps.yml b/.github/workflows/shared_steps.yml
index da9ad97..108463c 100644
--- a/.github/workflows/shared_steps.yml
+++ b/.github/workflows/shared_steps.yml
@@ -66,9 +66,21 @@ jobs:
needs:
- unit-test
- api-test
- if: always()
+ if: ${{ always() && github.event_name == 'schedule' }}
runs-on: ubuntu-latest
steps:
+ - name: checkout
+ uses: actions/checkout@v2
+ with:
+ ref: main
+
- name: Step 2
- run: |
- echo "workflow run ID: ${{ github.run_id }}"
+ env:
+ E_ROOM_ID: ${{ secrets.E_ROOM_ID }}
+ U_TOKEN: ${{ secrets.U_TOKEN }}
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ REPO_OWNER: SagarGi
+ REPO_NAME: ceck-expect-failure
+ RUN_ID: ${{ github.run_id }}
+ BRANCH_NAME: ${{ inputs.branch }}
+ run: ./.github/scripts/notify.sh