Skip to content

Commit

Permalink
test_cron 3
Browse files Browse the repository at this point in the history
test_cron 3
  • Loading branch information
piotrnarajowski committed Jul 22, 2024
1 parent cdefb83 commit 7bac0b9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
13 changes: 6 additions & 7 deletions .github/check_for_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ def main():
return

try:
commit = 'HEAD'
upstream = 'master'
commit = os.environ.get('PR_NUMBER')

mb = run_cmd(f"git merge-base {upstream} {commit}")
upstream = mb[0]

print(f"upstream: {upstream}")
# mb = run_cmd(f"git merge-base {upstream} {commit}")
# upstream = mb[0]
#
# print(f"upstream: {upstream}")

result = subprocess.run(
['git', 'diff', '--name-only', upstream, commit, '--', 'autopts/wid/'],
['git', 'diff', '--name-only', 'HEAD', commit, '--', 'autopts/wid/'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=True
)

Expand Down
11 changes: 10 additions & 1 deletion .github/workflows/run_cron_from_pr.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
name: Check PR for changes in autopts/wid/

on:
pull_request_target:
pull_request:
types: [ready_for_review, opened]
branches:
- master

env:
PR_NUMBER: ${{ github.event.number }}

jobs:
check_changes:
runs-on: ubuntu-latest
Expand All @@ -15,6 +18,12 @@ jobs:
with:
fetch-depth: 2

- name: Display PR Number (debug)
run: echo "PR Number is ${{ env.PR_NUMBER }}"

- name: Fetch PR refs
run: git fetch origin pull/${{ env.PR_NUMBER }}/head:pr-${{ env.PR_NUMBER }}

- name: Check for changes in autopts/wid directory
id: check_changes
run: |
Expand Down

0 comments on commit 7bac0b9

Please sign in to comment.