-
Notifications
You must be signed in to change notification settings - Fork 42
71 lines (62 loc) · 2.47 KB
/
osiris-subpar-coverage.yml
File metadata and controls
71 lines (62 loc) · 2.47 KB
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
71
name: Coverage Check for Osiris Generated AST files
on:
pull_request:
paths:
- '**/*.ast' # Only trigger if .ast files are changed
branches:
- main
jobs:
check-coverage:
runs-on: ubuntu-latest
outputs:
site_coverage_list: ${{ steps.set_coverage.outputs.site_coverage_list }}
coverage_below_threshold: ${{ steps.set_coverage.outputs.coverage_below_threshold }}
steps:
- name: Checkout Repos
uses: actions/checkout@v4
# uncomment when running or testing locally using [act](https://github.com/nektos/act?tab=readme-ov-file)
# with:
# token: ${{ secrets.API_TOKEN_GITHUB }}
# ref: DOP-5399-placeholder
- name: Verify Branch Checkout
run: |
git branch --show-current # Print the current branch
- name: Install Wget
run: sudo apt-get update && sudo apt-get install -y wget
- name: Clone Osiris
run: git clone https://x-access-token:${{ secrets.API_TOKEN_GITHUB }}@github.com/10gen/osiris.git cloned-osiris-repo
- name: Run Coverage Check
id: run_coverage
uses: mongodb/docs-worker-actions/coverage-check@main
with:
repo-path: cloned-osiris-repo
required-coverage: '90'
- name: Set Workflow Outputs
id: set_coverage
run: |
echo "coverage_below_threshold=${coverage_below_threshold}" >> $GITHUB_OUTPUT
echo "site_coverage_list=${SITE_COVERAGE_LIST}" >> $GITHUB_OUTPUT
send-slack-notification:
runs-on: ubuntu-latest
needs: check-coverage
if: needs.check-coverage.outputs.coverage_below_threshold == 'true'
steps:
- name: Send Slack Notification
env:
SITE_COVERAGE_LIST: ${{ needs.check-coverage.outputs.site_coverage_list }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
REPOSITORY: ${{ github.repository }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_NUMBER: ${{ github.event.pull_request.number }}
PR_URL: ${{ github.event.pull_request.html_url }}
PR_SHA: ${{ github.event.pull_request.head.sha }}
uses: mongodb/docs-worker-actions/coverage-report-to-slack@main
with:
required-coverage: '90'
site-coverage-list: $SITE_COVERAGE_LIST
slack-webhook-url: $SLACK_WEBHOOK_URL
repository: $REPOSITORY
pr-title: $PR_TITLE
pr-number: $PR_NUMBER
pr-url: $PR_URL
pr-sha: $PR_SHA