Skip to content

Commit

Permalink
aa
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 25, 2024
1 parent b8cd9d5 commit 576bd46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 17 deletions.
11 changes: 10 additions & 1 deletion .github/actions/get-modified-packages-docker/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,30 @@ runs:
git fetch origin ${{ inputs.base-ref }}
shell: bash

- name: Get modified files
id: get-modified-files
run: |
modified_files=$(git diff --name-only "origin/${{ inputs.base-ref }}"...HEAD)
echo "modified-files=$modified_files" >> $GITHUB_OUTPUT
shell: bash

- name: printenv
run: printenv
shell: bash

- name: Get modified packages
id: get-modified-packages
run: |
echo ${{ steps.get-modified-files.outputs.modified-files }}
echo ""
docker run --shm-size 1G \
-v ${{ github.workspace }}:/workspace \
-w /workspace \
-e GITHUB_ACTION_PATH \
-v ${GITHUB_ACTION_PATH}:${GITHUB_ACTION_PATH} \
ghcr.io/autowarefoundation/autoware:latest-prebuilt \
/bin/bash -c \
"ls -alF && ${GITHUB_ACTION_PATH}/get-modified-packages.sh origin/${{ inputs.base-ref }}"
"ls -alF && ${GITHUB_ACTION_PATH}/get-modified-packages.sh '${{ steps.get-modified-files.outputs.modified-files }}'"
echo "modified-packages=$modified_packages" >> $GITHUB_OUTPUT
shell: bash

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash
# Search for packages that have been modified from the base branch.
# Usage: get-modified-packages.sh <base_branch>
# Usage: get-modified-packages.sh '<modified_files>'

# Parse arguments
args=()
Expand All @@ -13,14 +12,7 @@ while [ "${1-}" != "" ]; do
shift
done

# example: base_branch="origin/main"
base_branch="${args[0]}"

# Check args
if [ "$base_branch" = "" ]; then
echo -e "\e[31mPlease input a valid base_branch as the 1st argument.\e[m"
exit 1
fi
modified_files="${args[0]}"

function find_package_dir() {
[ "$1" == "" ] && return 1
Expand Down Expand Up @@ -48,12 +40,6 @@ function find_package_dir() {
return 1
}

# Find modified files from the base branch
if ! modified_files=$(git diff --name-only "$base_branch"...HEAD); then
echo -e "\e[31mFailed to determine modified files. Please check if the base branch exists and fetch depth is sufficient.\e[m"
exit 1
fi

# Find modified packages
modified_package_dirs=()
for modified_file in $modified_files; do
Expand Down

0 comments on commit 576bd46

Please sign in to comment.