-
Notifications
You must be signed in to change notification settings - Fork 12
/
action.yml
49 lines (47 loc) · 1.78 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: 'Datadog Workflow Metrics'
description: 'Reports data on the workflow to datadog'
inputs:
datadog-metric-prefix:
description: 'A prefix for your datadog metrics'
required: false
default: 'github.action'
metrics-type:
description: '"velocity" or "job_metrics" depending on the desired metrics to be collected'
required: true
teams:
description: 'An array of teams to tag the time to merge metric with'
required: false
default: '[]'
tagged-branches:
description: 'If provided enables tagging for specified branches. Metrics are tagged with branch:{branch} or branch:other'
required: false
default: '[]'
custom-tags:
description: 'A list of tags to attach to the metrics. In the format of "[TAG1:VALUE1,TAG2:VALUE2,..]".'
required: false
default: '[]'
api-url:
description: 'The datadog regional api url. Defaults to https://api.datadoghq.com'
required: false
default: 'https://api.datadoghq.com'
runs:
using: "composite"
steps:
- uses: ruby/setup-ruby@v1
with:
working-directory: ${{ github.action_path }}
bundler-cache: true
- name: Export extra data
shell: bash
run: |
if [ "${{ inputs.metrics-type }}" == "velocity" ]; then
echo "PR_NUMBER=${{github.event.pull_request.number}}" >> $GITHUB_ENV
echo "ACTION=${{github.event.action}}" >> $GITHUB_ENV
else
echo "ACTION=${{ inputs.metrics-type }}" >> $GITHUB_ENV
fi
- id: metric
shell: bash
run: |
cd ${{ github.action_path }}
bundle exec ruby report_github_metrics.rb ${{github.repository}} ${{github.run_id}} ${{ inputs.datadog-metric-prefix }} '${{ inputs.teams }}' '${{ inputs.tagged-branches }}' '${{ inputs.custom-tags }}' ${{ inputs.api-url }}