1
+ name : Coverage Check for Osiris Generated AST files
2
+ on :
3
+ pull_request :
4
+ paths :
5
+ - ' **/*.ast' # Only trigger if .ast files are changed
6
+ branches :
7
+ - main
8
+
9
+ jobs :
10
+ check-coverage :
11
+ runs-on : ubuntu-latest
12
+ outputs :
13
+ site_coverage_list : ${{ steps.set_coverage.outputs.site_coverage_list }}
14
+ coverage_below_threshold : ${{ steps.set_coverage.outputs.coverage_below_threshold }}
15
+
16
+ steps :
17
+ - name : Checkout Repos
18
+ uses : actions/checkout@v4
19
+ # uncomment when running or testing locally using [act](https://github.com/nektos/act?tab=readme-ov-file)
20
+ # with:
21
+ # token: ${{ secrets.API_TOKEN_GITHUB }}
22
+ # ref: DOP-5399-placeholder
23
+
24
+ - name : Verify Branch Checkout
25
+ run : |
26
+ git branch --show-current # Print the current branch
27
+
28
+ - name : Install Wget
29
+ run : sudo apt-get update && sudo apt-get install -y wget
30
+
31
+ - name : Clone Osiris
32
+ run : git clone https://x-access-token:${{ secrets.API_TOKEN_GITHUB }}@github.com/10gen/osiris.git cloned-osiris-repo
33
+
34
+ - name : Run Coverage Check
35
+ id : run_coverage
36
+ uses : mongodb/docs-worker-actions/coverage-check@main
37
+ with :
38
+ repo-path : cloned-osiris-repo
39
+ required-coverage : ' 90'
40
+
41
+ - name : Set Workflow Outputs
42
+ id : set_coverage
43
+ run : |
44
+ echo "coverage_below_threshold=${coverage_below_threshold}" >> $GITHUB_OUTPUT
45
+ echo "site_coverage_list=${SITE_COVERAGE_LIST}" >> $GITHUB_OUTPUT
46
+
47
+ send-slack-notification :
48
+ runs-on : ubuntu-latest
49
+ needs : check-coverage
50
+ if : needs.check-coverage.outputs.coverage_below_threshold == 'true'
51
+
52
+ steps :
53
+ - name : Send Slack Notification
54
+ env :
55
+ SITE_COVERAGE_LIST : ${{ needs.check-coverage.outputs.site_coverage_list }}
56
+ SLACK_WEBHOOK_URL : ${{ secrets.SLACK_WEBHOOK_URL }}
57
+ REPOSITORY : ${{ github.repository }}
58
+ PR_TITLE : ${{ github.event.pull_request.title }}
59
+ PR_NUMBER : ${{ github.event.pull_request.number }}
60
+ PR_URL : ${{ github.event.pull_request.html_url }}
61
+ PR_SHA : ${{ github.event.pull_request.head.sha }}
62
+ uses : mongodb/docs-worker-actions/coverage-report-to-slack@main
63
+ with :
64
+ required-coverage : ' 90'
65
+ site-coverage-list : $SITE_COVERAGE_LIST
66
+ slack-webhook-url : $SLACK_WEBHOOK_URL
67
+ repository : $REPOSITORY
68
+ pr-title : $PR_TITLE
69
+ pr-number : $PR_NUMBER
70
+ pr-url : $PR_URL
71
+ pr-sha : $PR_SHA
0 commit comments