-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
70 lines (65 loc) · 2.13 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
inputs:
directory:
description: "Directory containing OpenSAFELY project"
required: false
default: .
users:
description: "@names of users who should be notified on dataset failure"
required: false
default: "@amirmehrkar @JulietUnderdown1 @LiamHart-hub @iaindillingham"
outputs:
issue:
description: "url of issue created"
value: ${{ steps.datasets.outputs.issue }}
runs:
using: "composite"
steps:
- name: Install opensafely
shell: bash
run: |
python3 -m pip install --quiet --upgrade opensafely
opensafely --version
- name: Check codelists
shell: bash
working-directory: ${{ inputs.directory }}
run: opensafely codelists check
- name: Check datasets
shell: bash
id: datasets
working-directory: ${{ inputs.directory }}
run: |
success=true
OUTPUT=$(opensafely check 2>&1) || success=false
echo "$OUTPUT"
# exit early if we're all good
test "$success" = "true" && exit 0
BODY=$(cat << EOF
Dataset check for $GITHUB_REPOSITORY at $GITHUB_SHA:
\`\`\`
$OUTPUT
\`\`\`
${{ inputs.users }}
EOF
)
ISSUE_URL=$(gh issue create --title "Dataset check fail" --body "$BODY")
echo "Created issue at $ISSUE_URL"
echo "::set-output name=issue::$ISSUE_URL"
exit 1
- name: Run project
shell: bash
working-directory: ${{ inputs.directory }}
run: opensafely run run_all --continue-on-error --timestamps --format-output-for-github
- name: Parse stats logs
if: ${{ env.HONEYCOMB_API_KEY }}
shell: bash
run: opensafely extract-stats
working-directory: ${{ inputs.directory }}
- name: Send extracted stats to honeycomb
if: ${{ env.HONEYCOMB_API_KEY }}
shell: bash
run: |
docker run --pull=missing --rm \
--volume $GITHUB_ACTION_PATH/${{ inputs.directory }}/metadata/extracted_stats.json:/src/log_file.json \
--env HONEYCOMB_WRITE_KEY=$HONEYCOMB_API_KEY \
--env DATASET=research-action \
ghcr.io/opensafely-core/honeytail:latest