forked from aabhinavg1/compilersutra
-
Notifications
You must be signed in to change notification settings - Fork 0
78 lines (67 loc) · 2.33 KB
/
Copy pathbuild_and_notify.yml
File metadata and controls
78 lines (67 loc) · 2.33 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
72
73
74
75
76
77
78
name: Build and Notify
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
jobs:
build_and_notify:
runs-on: ubuntu-latest
steps:
# ---------------------------------
# 0️⃣ Checkout
# ---------------------------------
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Log checkout info
run: |
echo "Repository checked out"
echo "Commit SHA: $GITHUB_SHA"
echo "Branch: $GITHUB_REF"
# ---------------------------------
# 1️⃣ Detect docs changes
# ---------------------------------
- name: Detect docs changes
id: detect_docs
run: |
BASE="${{ github.event.before }}"
HEAD="${{ github.sha }}"
if [ "$BASE" = "0000000000000000000000000000000000000000" ]; then
BASE="$(git rev-list --max-parents=0 HEAD)"
fi
if git diff --name-only "$BASE" "$HEAD" | grep -q '^docs/'; then
echo "DOCS_CHANGED=true" >> "$GITHUB_ENV"
else
echo "DOCS_CHANGED=false" >> "$GITHUB_ENV"
fi
# Save commits to environment for Python script
echo "BASE_COMMIT=$BASE" >> "$GITHUB_ENV"
echo "HEAD_COMMIT=$HEAD" >> "$GITHUB_ENV"
# ---------------------------------
# 2️⃣ Enforce commit policy & send Discord
# ---------------------------------
- name: Enforce commit policy and notify
env:
DOCS_CHANGED: ${{ env.DOCS_CHANGED }}
BASE_COMMIT: ${{ env.BASE_COMMIT }}
HEAD_COMMIT: ${{ env.HEAD_COMMIT }}
DISCORD_WEBHOOK_GENERAL: ${{ secrets.DISCORD_WEBHOOK_GENERAL }}
DISCORD_WEBHOOK_LLVM_DISCUSSION: ${{ secrets.DISCORD_WEBHOOK_LLVM_DISCUSSION }}
run: |
python3 .ci/commit_policy.py
# ---------------------------------
# 3️⃣ Build project
# ---------------------------------
- name: Build project
run: |
echo "Starting build"
echo "Build completed successfully"
# ---------------------------------
# 4️⃣ Notify pipeline completion
# ---------------------------------
- name: Notify
run: |
echo "Documentation changed: $DOCS_CHANGED"
echo "CI pipeline finished"