From 53512bbbb27d14d4ba27d95b7403be973402d46e Mon Sep 17 00:00:00 2001 From: Piotr Narajowski Date: Wed, 10 Apr 2024 15:42:21 +0200 Subject: [PATCH] actions: run CRON on PR test PR --- .github/workflows/check_pr_changes.yaml | 46 +++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/check_pr_changes.yaml diff --git a/.github/workflows/check_pr_changes.yaml b/.github/workflows/check_pr_changes.yaml new file mode 100644 index 0000000000..024a314c3a --- /dev/null +++ b/.github/workflows/check_pr_changes.yaml @@ -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 + }); \ No newline at end of file