forked from auto-pts/auto-pts
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from piotrnarajowski/actions_1
actions: run CRON on PR
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
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@v2 | ||
|
||
- name: List changed files | ||
id: list_files | ||
run: | | ||
git diff --name-only origin/master...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 context = github.context; | ||
const owner = context.payload.repository.owner.login; | ||
const repo = context.payload.repository.name; | ||
const prNumber = context.payload.pull_request.number; | ||
const commentBody = '#AutoPTS run zephyr MCP'; | ||
github.issues.createComment({ | ||
owner, | ||
repo, | ||
issue_number: prNumber, | ||
body: commentBody | ||
}); |