Skip to content

Commit

Permalink
ci: debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
nishaq503 committed Feb 19, 2024
1 parent 7105956 commit abfb5bd
Showing 1 changed file with 47 additions and 6 deletions.
53 changes: 47 additions & 6 deletions .github/workflows/filter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,19 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
repository: ${{ github.repository }}
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
persist-credentials: false
- name: Find Updated Packages and crates
id: filter
run: |
CRATE_DIRS=""
PACKAGE_DIRS=""
echo "The head ref is ${{ github.head_ref }}"
echo "The last five commits messages are $(git log -5 --pretty=%B)"
echo "name of current branch is ${{ github.ref }}"
# echo the base ref
base_ref=${{ github.base_ref }}
if [ -z "$base_ref" ]
Expand All @@ -52,6 +56,7 @@ jobs:
# Get the comparison point in the repo
comparison_point="origin/${base_ref}"
echo "The comparison point is $comparison_point"
echo "The changed files are $(git diff --name-only ${comparison_point}...)"
for changed_file in $(git diff --name-only ${comparison_point}...)
do
Expand All @@ -64,9 +69,16 @@ jobs:
continue
fi
# Check if the changed file is a Cargo.toml or pyproject.toml file
if [ "${file_name}" == *"Cargo.toml"* ] | [ "${file_name}" == *"pyproject.toml"* ]
# Check if the changed file is a Cargo.toml
if [ "${file_name}" == *"Cargo.toml"* ]
then
echo "Found a crate in $pkg_dir"
if [ ! -f $pkg_dir/VERSION ]
then
echo "No version file found in $pkg_dir"
continue
fi
# Check that the version is a dev version
echo "Checking for dev version in $pkg_dir"
Expand All @@ -82,10 +94,39 @@ jobs:
fi
# If the package directory string contains the substring "crates", add it to the CRATE_DIRS string
if [ "$pkg_dir" =~ "crates"* ]
if [ "$pkg_dir" == *"crates"* ]
then
CRATE_DIRS="$CRATE_DIRS ${pkg_dir}"
else
fi
fi
# Check if the changed file is a pyproject.toml
if [ "${file_name}" == *"pyproject.toml"* ]
then
echo "Found a package in $pkg_dir"
if [ ! -f $pkg_dir/VERSION ]
then
echo "No version file found in $pkg_dir"
continue
fi
# Check that the version is a dev version
echo "Checking for dev version in $pkg_dir"
if [ $(cat $pkg_dir/VERSION) != *"dev"* ]
then
msg="${pkg_dir} does not have a dev version"
if [ ${{ inputs.ignore-missing-dev }} ]
then
echo "::warning::${msg}"
else
echo "::error::${msg}" && exit 1
fi
fi
# If the package directory string contains the substring "python", add it to the PACKAGE_DIRS string
if [ "$pkg_dir" == *"python"* ]
then
PACKAGE_DIRS="$PACKAGE_DIRS ${pkg_dir}"
fi
fi
Expand Down

0 comments on commit abfb5bd

Please sign in to comment.