Skip to content

Commit

Permalink
use base_sha instead
Browse files Browse the repository at this point in the history
Signed-off-by: M. Fatih Cırıt <[email protected]>
  • Loading branch information
M. Fatih Cırıt committed Jun 11, 2024
1 parent 52e3d6e commit b4135e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 3 additions & 3 deletions get-modified-packages/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ name: get-modified-packages
description: ""

inputs:
base-branch:
base-sha:
description: ""
required: false
default: ${{ github.base_ref }}
default: ${{ github.event.pull_request.base.sha }}

outputs:
modified-packages:
Expand All @@ -23,7 +23,7 @@ runs:
- name: Get modified packages
id: get-modified-packages
run: |
echo "modified-packages=$(${GITHUB_ACTION_PATH}/get-modified-packages.sh origin/${{ inputs.base-branch }})" >> $GITHUB_OUTPUT
echo "modified-packages=$(${GITHUB_ACTION_PATH}/get-modified-packages.sh ${{ inputs.base-sha }})" >> $GITHUB_OUTPUT
shell: bash

- name: Show result
Expand Down
8 changes: 3 additions & 5 deletions get-modified-packages/get-modified-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ while [ "${1-}" != "" ]; do
shift
done

# base_branch is like "origin/main"
base_branch="${args[0]}"
echo "base_branch: $base_branch"
base_sha="${args[0]}"

# Check args
if [ "$base_branch" = "" ]; then
if [ "$base_sha" = "" ]; then
echo -e "\e[31mPlease input a valid base_branch as the 1st argument.\e[m"
exit 1
fi
Expand Down Expand Up @@ -52,7 +50,7 @@ function find_package_dir() {
}

# Find modified files from base branch
modified_files=$(git diff --name-only "$base_branch"...HEAD)
modified_files=$(git diff --name-only "$base_sha"...HEAD)

# Find modified packages
modified_package_dirs=()
Expand Down

0 comments on commit b4135e3

Please sign in to comment.