-
Notifications
You must be signed in to change notification settings - Fork 116
63 lines (52 loc) · 1.86 KB
/
metal-api-surface.yaml
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
name: Compute Public API Surface
on:
workflow_dispatch:
workflow_call:
push:
branches: ["main"]
permissions:
actions: read
contents: write
pull-requests: write
pages: write
id-token: write
packages: write
jobs:
compute_and_notify:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x' # Ensures latest stable Python 3
- name: Install dependencies
run: python3 -m pip install tree-sitter tree-sitter-cpp
- name: Download script
run: |
wget -O compute_public_api_surface.py https://gist.githubusercontent.com/ayerofieiev-tt/ea5fe814bd6741b08708883669ed022d/raw/9e8b193cf26071877a6d663fb89b0223e709406f/compute_public_api_surface.py
- name: Run script
id: compute_api
run: |
python3 compute_public_api_surface.py > raw_output.json
cat raw_output.json
- name: Reformat JSON for Slack
run: |
date=$(jq -r '.date' raw_output.json)
num_files=$(jq -r '.num_files' raw_output.json)
num_types=$(jq -r '.num_types' raw_output.json)
num_methods=$(jq -r '.num_methods' raw_output.json)
echo "DATE=$date" >> $GITHUB_ENV
echo "NUM_FILES=$num_files" >> $GITHUB_ENV
echo "NUM_TYPES=$num_types" >> $GITHUB_ENV
echo "NUM_METHODS=$num_methods" >> $GITHUB_ENV
- name: Send Slack message to a channel
uses: slackapi/slack-github-action@v1.26.0
with:
payload: |
{
"text": "date: ${{ env.DATE }} \nnum_files: ${{ env.NUM_FILES }} \nnum_types: ${{ env.NUM_TYPES }} \nnum_methods: ${{ env.NUM_METHODS }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.METAL_API_SURFACE_WEBHOOK }}