Skip to content

Commit

Permalink
AAE-17087 new action + improvement in slack action
Browse files Browse the repository at this point in the history
  • Loading branch information
wojciech-piotrowiak committed Oct 5, 2023
1 parent 1051d3e commit c00f006
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 22 deletions.
35 changes: 35 additions & 0 deletions .github/actions/run-time-exceeded-notification/action.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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 }}
9 changes: 0 additions & 9 deletions .github/actions/run-time-notification/action.yml

This file was deleted.

1 change: 1 addition & 0 deletions .github/actions/send-slack-notification/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ runs:

- name: Send slack notification
id: slack
if: ${{ inputs.token != '' }}
uses: slackapi/[email protected]
env:
SLACK_BOT_TOKEN: ${{ inputs.token }}
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/test_me.yml

This file was deleted.

0 comments on commit c00f006

Please sign in to comment.