File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Java CI with Maven
2+
3+ on :
4+ pull_request :
5+ types : [opened, synchronize]
6+ push :
7+ branches : [ main ]
8+
9+ jobs :
10+ build :
11+
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout code
16+ uses : actions/checkout@v4
17+
18+ - name : Set up Java
19+ uses : actions/setup-java@v4
20+ with :
21+ distribution : ' temurin'
22+ java-version : ' 21'
23+
24+ - name : Build and Test with Maven
25+ run : mvn clean install
26+
27+ - name : Notify on PR creation
28+ if : github.event_name == 'pull_request' && github.event.action == 'opened'
29+ run : |
30+ curl -X POST https://your-api-endpoint.com/notify \
31+ -H "Content-Type: application/json" \
32+ -d '{
33+ "event": "PR_CREATED",
34+ "repo": "${{ github.repository }}",
35+ "url": "${{ github.event.pull_request.html_url }}",
36+ "author": "${{ github.actor }}"
37+ }'
38+
39+ - name : Notify on Build Failure
40+ if : failure()
41+ run : |
42+ curl -X POST https://your-api-endpoint.com/notify \
43+ -H "Content-Type: application/json" \
44+ -d '{
45+ "event": "BUILD_FAILED",
46+ "repo": "${{ github.repository }}",
47+ "url": "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}",
48+ "author": "${{ github.actor }}"
49+ }'
You can’t perform that action at this time.
0 commit comments