Skip to content

Commit efdbee3

Browse files
committed
add on pr workflow
1 parent c23053d commit efdbee3

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/pr.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "Pull Request check"
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
pull-requests: write
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v3
18+
- name: Clone submodules
19+
run: |
20+
git submodule init
21+
git submodule update
22+
- name: Update and Install dependencies
23+
run: |
24+
sudo apt-get update
25+
sudo apt-get install -y cmake build-essential g++
26+
- name: Build
27+
id: build
28+
run: |
29+
mkdir build
30+
cd build
31+
cmake ..
32+
make
33+
- name: Post success comment
34+
if: ${{ success() }}
35+
uses: actions/github-script@v6
36+
with:
37+
script: |
38+
github.rest.issues.createComment({
39+
issue_number: context.issue.number,
40+
owner: context.repo.owner,
41+
repo: context.repo.repo,
42+
body: 'Build successful! 🎉'
43+
});
44+
- name: Post failure comment
45+
if: ${{ failure() }}
46+
uses: actions/github-script@v6
47+
with:
48+
script: |
49+
github.rest.issues.createComment({
50+
...context.repo,
51+
issue_number: context.issue.number,
52+
owner: context.repo.owner,
53+
repo: context.repo.repo,
54+
body: `Build failed! ❌\n\n\`\`\`\n${{ steps.build.outputs.stderr || 'Unknown error' }}\n\`\`\``
55+
});

0 commit comments

Comments
 (0)