forked from auto-pts/auto-pts
-
Notifications
You must be signed in to change notification settings - Fork 0
47 lines (41 loc) · 1.34 KB
/
check_pr_changes.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
name: Check PR Changes and Comment
on:
pull_request:
branches:
- master
jobs:
check_changes:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: List changed files
id: list_files
run: |
git diff --name-only HEAD^1 HEAD > changed_files.txt
- name: Check for changes in autopts/wid directory
id: check_changes
run: |
if grep -q "^autopts/wid/" changed_files.txt; then
echo "::set-output name=changes_detected::true"
else
echo "::set-output name=changes_detected::false"
fi
- name: Post comment on PR if changes detected
if: steps.check_changes.outputs.changes_detected == 'true'
uses: actions/github-script@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const owner = github.context.payload.repository.owner.login;
const repo = github.context.payload.repository.name;
const prNumber = github.context.payload.pull_request.number;
const commentBody = '#AutoPTS run zephyr MCP';
github.issues.createComment({
owner,
repo,
issue_number: prNumber,
body: commentBody
});