diff --git a/.github/actions/run-time-exceeded-notification/action.yml b/.github/actions/run-time-exceeded-notification/action.yml new file mode 100644 index 000000000..7d8f09758 --- /dev/null +++ b/.github/actions/run-time-exceeded-notification/action.yml @@ -0,0 +1,35 @@ +name: send a exceeded build time notification +description: Sends slack notification if build took more than planned + +inputs: + max-build-time: + description: "Maximum acceptable build time in seconds" + required: true + slack-token: + description: The slack bot token + required: true + slack-channel: + description: The slack channel + required: true + +runs: + using: composite + steps: + - name: Fetch billable time from gh API + id: fetch_time + env: + GH_TOKEN: ${{ github.token }} + total_time: "" + shell: bash + run: | + total_time=$(gh api /repos/${{github.repository}}/actions/runs/${{github.run_id}}/timing | jq ' .billable.UBUNTU.total_ms /1000') + echo "total_time in seconds: ${total_time}" + echo "total_time=${total_time}" >> $GITHUB_OUTPUT + + - name: Slack Notification + if: steps.fetch_time.outputs.total_time > ${{inputs.max-build-time}} + uses: Alfresco/alfresco-build-tools/.github/actions/send-slack-notification@v2.3.0 + with: + channel-id: ${{ inputs.slack-channel }} + message: 'build time took ${{steps.fetch_time.outputs.total_time}} seconds when expected ${{inputs.max-build-time}} seconds' + token: ${{ inputs.slack-token }} diff --git a/.github/actions/run-time-notification/action.yml b/.github/actions/run-time-notification/action.yml deleted file mode 100644 index 4f27ae727..000000000 --- a/.github/actions/run-time-notification/action.yml +++ /dev/null @@ -1,9 +0,0 @@ -name: notification when run took too much time -description: 'something' - -runs: - using: "composite" - steps: - - name: print - run: | - echo "something" diff --git a/.github/actions/send-slack-notification/action.yml b/.github/actions/send-slack-notification/action.yml index ff3be722a..2088faa30 100644 --- a/.github/actions/send-slack-notification/action.yml +++ b/.github/actions/send-slack-notification/action.yml @@ -79,6 +79,7 @@ runs: - name: Send slack notification id: slack + if: ${{ inputs.token != '' }} uses: slackapi/slack-github-action@v1.23.0 env: SLACK_BOT_TOKEN: ${{ inputs.token }} diff --git a/.github/workflows/test_me.yml b/.github/workflows/test_me.yml deleted file mode 100644 index de1d22e3b..000000000 --- a/.github/workflows/test_me.yml +++ /dev/null @@ -1,13 +0,0 @@ -#Deploy SNAPSHOTS artifacts once a day to Nexus, so they can be consumed by Veracode -name: test workflow - -on: - workflow_dispatch: -jobs: - build: - name: Build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: run notification - uses: ./.github/actions/run-time-notification