-
Notifications
You must be signed in to change notification settings - Fork 281
49 lines (42 loc) · 1.42 KB
/
pr-test-notifier.yml
File metadata and controls
49 lines (42 loc) · 1.42 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
name: PR Test Notifier
on:
pull_request:
types: [opened, reopened]
branches:
- main
permissions:
pull-requests: write
jobs:
# Check if pipeline should be skipped based on first line of commit message
check-skip:
runs-on: ubuntu-latest
outputs:
should-skip: ${{ steps.check.outputs.should-skip }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check if pipeline should be skipped
id: check
run: |
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
FIRST_LINE=$(echo "$COMMIT_MESSAGE" | head -n 1)
if [[ "$FIRST_LINE" == *"--skip-pipeline"* ]]; then
echo "should-skip=true" >> $GITHUB_OUTPUT
else
echo "should-skip=false" >> $GITHUB_OUTPUT
fi
notify:
needs: [check-skip]
if: needs.check-skip.outputs.should-skip != 'true'
name: Post Test Instructions
runs-on: ubuntu-latest
steps:
- name: Post comment with test trigger instructions
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr comment ${{ github.event.pull_request.number }} \
--repo ${{ github.repository }} \
--body "## 🧪 Test Suite Available
This PR can be tested by a repository admin.
[Run tests for PR #${{ github.event.pull_request.number }}](https://github.com/${{ github.repository }}/actions/workflows/pr-tests.yml)"