Skip to content

Commit

Permalink
CI automations improvement
Browse files Browse the repository at this point in the history
Switch to pull_request_target in preview-comment.yml.

Compare the updated files to merge-base trunk instead of trunk in
validate_pr.yml.
  • Loading branch information
adamziel committed Apr 19, 2024
1 parent 16a9ea1 commit c196946
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/preview-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Pull Request Comments

on:
pull_request:
pull_request_target:

# Disable permissions for all available scopes by default.
# Any needed permissions should be configured at the job level.
Expand Down
5 changes: 3 additions & 2 deletions validate_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ def find_urls(obj):


def get_touched_directories():
# Run git diff command to get the list of directories touched in the current branch
diff_output = os.popen('git diff --name-only origin/trunk').read()
# Run git diff command to get the list of directories touched in the current branch as compared to
# the point where it was forked from the trunk branch
diff_output = os.popen('git diff --name-only $(git merge-base trunk HEAD)').read()
touched_dirs = set()

# Extract the directory paths from the diff output
Expand Down

0 comments on commit c196946

Please sign in to comment.