Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions .github/actions/registry-diff/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ inputs:
base_sha:
description: "The base commit SHA to compare against"
required: true
head_sha:
description: "The head commit SHA to compare against"
required: true
outputs:
modified_tools:
description: "Space-separated list of all modified tools"
Expand All @@ -18,15 +21,18 @@ runs:
steps:
- id: diff
shell: bash
env:
BASE_SHA: ${{ inputs.base_sha }}
HEAD_SHA: ${{ inputs.head_sha }}
run: |
# Get added/modified registry files and extract tool names
# Get added/copied/modified/renamed registry files and extract tool names
# (deleted files are excluded — they can't be tested)
modified=$(git diff --name-only --diff-filter=AM ${{ inputs.base_sha }} HEAD -- 'registry/*.toml' \
modified=$(git diff --name-only --diff-filter=ACMR "$BASE_SHA" "$HEAD_SHA" -- 'registry/*.toml' \
| xargs -I{} basename {} .toml \
| tr '\n' ' ')

# Get newly added registry files
new=$(git diff --name-only --diff-filter=A ${{ inputs.base_sha }} HEAD -- 'registry/*.toml' \
new=$(git diff --name-only --diff-filter=A "$BASE_SHA" "$HEAD_SHA" -- 'registry/*.toml' \
| xargs -I{} basename {} .toml \
| tr '\n' ' ')

Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,24 @@ jobs:
timeout-minutes: 5
outputs:
registry-changed: ${{ steps.check.outputs.registry-changed }}
diff-base-sha: ${{ steps.check.outputs.diff-base-sha }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- id: check
env:
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ] || [ "${{ github.event_name }}" == "push" ]; then
echo "registry-changed=true" >> "$GITHUB_OUTPUT"
exit 0
fi
diff_base_sha="$(git merge-base "$PR_BASE_SHA" "$PR_HEAD_SHA")"
echo "diff-base-sha=$diff_base_sha" >> "$GITHUB_OUTPUT"
# Check if relevant files changed
if git diff --name-only ${{ github.event.pull_request.base.sha }} HEAD | grep -qE '^(registry/.*\.toml|\.github/workflows/registry\.yml|src/cli/test_tool\.rs)$'; then
if git diff --name-only "$diff_base_sha" "$PR_HEAD_SHA" | grep -qE '^(registry/.*\.toml|\.github/workflows/registry\.yml|src/cli/test_tool\.rs)$'; then
echo "registry-changed=true" >> "$GITHUB_OUTPUT"
else
echo "registry-changed=false" >> "$GITHUB_OUTPUT"
Expand Down Expand Up @@ -95,15 +101,19 @@ jobs:
with:
fetch-depth: 0
- id: workflow-check
env:
DIFF_BASE_SHA: ${{ needs.check-changes.outputs.diff-base-sha }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
if git diff --name-only ${{ github.event.pull_request.base.sha }} HEAD | grep -q ".github/workflows/registry.yml"; then
if git diff --name-only "$DIFF_BASE_SHA" "$PR_HEAD_SHA" | grep -q ".github/workflows/registry.yml"; then
echo "modified=true" >> "$GITHUB_OUTPUT"
fi
- uses: ./.github/actions/registry-diff
id: registry-diff
if: steps.workflow-check.outputs.modified != 'true'
with:
base_sha: ${{ github.event.pull_request.base.sha }}
base_sha: ${{ needs.check-changes.outputs.diff-base-sha }}
head_sha: ${{ github.event.pull_request.head.sha }}
- id: determine-tools
run: |
if [ "${{ steps.workflow-check.outputs.modified }}" == "true" ]; then
Expand Down
Loading