From b7d57369957709ae3e17adff852ebc879dae72fa Mon Sep 17 00:00:00 2001 From: Eric Gustin <34000337+EricGustin@users.noreply.github.com> Date: Sat, 15 Mar 2025 14:15:01 -0800 Subject: [PATCH] Replace changed-files GH Action (#295) --- .github/workflows/check-toolkits.yml | 38 +++++++++++++++++++++++----- toolkits/notion/pyproject.toml | 2 +- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/.github/workflows/check-toolkits.yml b/.github/workflows/check-toolkits.yml index f5af6506..c6e32b51 100644 --- a/.github/workflows/check-toolkits.yml +++ b/.github/workflows/check-toolkits.yml @@ -21,10 +21,36 @@ jobs: - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v45 - with: - files: | - toolkits/** + run: | + echo "Determining the base commit from the event payload..." + # Attempt to retrieve the 'before' commit from the event JSON. + if [ -f "$GITHUB_EVENT_PATH" ]; then + BASE=$(jq -r '.before' "$GITHUB_EVENT_PATH") + fi + # If not available or if it's the all-zero SHA (i.e. first commit), fallback to HEAD^. + if [ -z "$BASE" ] || [ "$BASE" = "0000000000000000000000000000000000000000" ]; then + BASE=HEAD^ + fi + echo "Using commit range: $BASE...$GITHUB_SHA" + + # List all files changed between BASE and the current commit. + CHANGED_FILES=$(git diff --name-only "$BASE" "$GITHUB_SHA") + echo "Changed files (raw):" + echo "$CHANGED_FILES" + + # Filter only files under the toolkits/ directory. + matched="" + for file in $CHANGED_FILES; do + if [[ "$file" == toolkits/* ]]; then + matched="$matched$file " + fi + done + # Trim any extra whitespace. + matched=$(echo "$matched" | xargs) + echo "Matched changed files: $matched" + + # Make the list available to subsequent steps as an output. + echo "all_changed_files=$matched" >> $GITHUB_OUTPUT - name: List all added files env: @@ -34,8 +60,8 @@ jobs: dirs=$(echo "${CHANGED_FILES}" | tr ' ' '\n' | grep "toolkits/" | cut -d'/' -f2 | sort -u) if [ -n "$dirs" ]; then echo "$dirs" | while read -r dir; do - echo "$dir" - gh workflow -R ArcadeAI/arcade-ai run "Publish Toolkit" -f toolkit=${dir} + echo "Publishing toolkit: $dir" + gh workflow -R ArcadeAI/arcade-ai run "Publish Toolkit" -f toolkit="${dir}" done else echo "No toolkit directories were changed" diff --git a/toolkits/notion/pyproject.toml b/toolkits/notion/pyproject.toml index 861e5493..c4e944b8 100644 --- a/toolkits/notion/pyproject.toml +++ b/toolkits/notion/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "arcade_notion" -version = "0.0.1" +version = "0.1.0" description = "LLM tools for essential Notion interactions such as creating, updating, retrieving, and searching pages." authors = ["ArcadeAI "]