[recipe workflow]: Fix Invalid revision range error (#5334)
This commit is contained in:
@@ -6,16 +6,21 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- 'documentation/src/pages/recipes/data/recipes/**'
|
- 'documentation/src/pages/recipes/data/recipes/**'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
send-api-key:
|
send-api-key:
|
||||||
if: github.event.pull_request.merged == true
|
if: github.event.pull_request.merged == true
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repo
|
- name: Checkout repo at merge commit
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
|
ref: ${{ github.event.pull_request.merge_commit_sha }}
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Check if recipe files were added or modified in merged PR
|
- name: Check if recipe files were added or modified in merged PR
|
||||||
@@ -24,26 +29,21 @@ jobs:
|
|||||||
set -e
|
set -e
|
||||||
echo "🔍 Checking if recipe files were added or modified in merged PR..."
|
echo "🔍 Checking if recipe files were added or modified in merged PR..."
|
||||||
|
|
||||||
# Get the PR merge information
|
MERGE_COMMIT="${{ github.event.pull_request.merge_commit_sha }}"
|
||||||
MERGE_COMMIT=$(git rev-parse HEAD)
|
|
||||||
echo "Merge commit: $MERGE_COMMIT"
|
echo "Merge commit: $MERGE_COMMIT"
|
||||||
|
|
||||||
# For merged PRs, compare the PR's changes against the base branch
|
# Get parent commit of the merge
|
||||||
# Use the PR information from the event to get the actual changes
|
PARENT_COMMIT=$(git rev-parse "$MERGE_COMMIT^1")
|
||||||
BASE_SHA="${{ github.event.pull_request.base.sha }}"
|
echo "Parent commit: $PARENT_COMMIT"
|
||||||
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
|
|
||||||
|
# Get list of added or modified files in the PR (ignore deletions)
|
||||||
echo "PR base SHA: $BASE_SHA"
|
CHANGED_FILES=$(git diff --name-only --diff-filter=AM "$PARENT_COMMIT" "$MERGE_COMMIT")
|
||||||
echo "PR head SHA: $HEAD_SHA"
|
|
||||||
|
|
||||||
# Get the list of files that were added or modified in the PR (not deleted)
|
|
||||||
CHANGED_FILES=$(git diff --name-only --diff-filter=AM $BASE_SHA..$HEAD_SHA)
|
|
||||||
|
|
||||||
echo "Files added/modified in merged PR:"
|
echo "Files added/modified in merged PR:"
|
||||||
echo "$CHANGED_FILES"
|
echo "$CHANGED_FILES"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# Check if any recipe files were added or modified
|
# Detect recipe changes only
|
||||||
if echo "$CHANGED_FILES" | grep -q "^documentation/src/pages/recipes/data/recipes/"; then
|
if echo "$CHANGED_FILES" | grep -q "^documentation/src/pages/recipes/data/recipes/"; then
|
||||||
echo "recipe_files_changed=true" >> "$GITHUB_OUTPUT"
|
echo "recipe_files_changed=true" >> "$GITHUB_OUTPUT"
|
||||||
echo "✅ Recipe files were added/modified in merged PR - proceeding with API key sending"
|
echo "✅ Recipe files were added/modified in merged PR - proceeding with API key sending"
|
||||||
|
|||||||
Reference in New Issue
Block a user