Skip to content

Commit d2caaf6

Browse files
committed
Do not fail Vendor.yml when no changes imported
This change improves the check in the DuckDB engine sources vendoring process. If no changes are detected in the incoming sources then the remaining of the `Vendor.yml` job is skipped instead of moving it to "Failure" state. Testing: debugged this in a separate repo.
1 parent 1fc5939 commit d2caaf6

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

.github/workflows/Vendor.yml

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,31 +63,37 @@ jobs:
6363
git checkout vendoring-${{ github.ref_name }}
6464
git rebase ${{ github.ref_name }}
6565
# Call the vendoring script in the engine
66-
git rm -rf src/duckdb
66+
rm -rf src/duckdb
6767
python vendor.py --duckdb .git/duckdb
68-
git add src/duckdb CMakeLists.txt
6968
# Clean up
7069
rm -rf .git/duckdb
7170
# Export vendor revision for use in later steps
7271
echo "vendor_rev=${REV}" >> "${GITHUB_OUTPUT}"
7372
73+
- name: Check for incoming changes
74+
if: ${{ steps.vendor.outcome == 'success' }}
75+
id: check_for_changes
76+
run: |
77+
if git diff --exit-code; then
78+
echo "No vendoring changes detected, skipping the remaining of the job."
79+
else
80+
echo "Changes detected, proceeding with commit and push."
81+
echo "has_changes=true" >> "${GITHUB_OUTPUT}"
82+
fi
83+
7484
- name: Commit and push the changes
7585
id: commit_and_push
86+
if: ${{ steps.check_for_changes.outcome == 'success' && steps.check_for_changes.outputs.has_changes == 'true' }}
7687
run: |
7788
MSG="Update vendored DuckDB sources to ${{ steps.vendor.outputs.vendor_rev }}"
89+
git add src/duckdb CMakeLists.txt
7890
git commit -m "${MSG}"
79-
# Check if ahead of upstream branch
80-
# If yes, set a step output
81-
git push -f --dry-run origin vendoring-${{ github.ref_name }}
82-
if [ $(git rev-list HEAD...origin/${{ github.ref_name }} --count) -gt 0 ]; then
83-
git push -f origin vendoring-${{ github.ref_name }}
84-
# Avoid set-output, it's deprecated
85-
echo "push_performed=true" >> "${GITHUB_OUTPUT}"
86-
echo "commit_msg=${MSG}" >> "${GITHUB_OUTPUT}"
87-
fi
91+
git push -f origin vendoring-${{ github.ref_name }}
92+
echo "commit_msg=${MSG}" >> "${GITHUB_OUTPUT}"
8893
8994
- name: Check PR exists
9095
id: check_pr_exists
96+
if: ${{ steps.commit_and_push.outcome == 'success' }}
9197
env:
9298
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9399
run: |
@@ -103,6 +109,7 @@ jobs:
103109
104110
- name: Prepare PR message
105111
id: prepare_pr_message
112+
if: ${{ steps.check_pr_exists.outcome == 'success' }}
106113
run: |
107114
DATE="$(date +"%Y-%m-%d %H:%M:%S")"
108115
CHANGE_LABEL="duckdb/duckdb#${{ steps.vendor.outputs.vendor_rev }}"
@@ -113,7 +120,7 @@ jobs:
113120
114121
- name: Create PR
115122
id: create_pr
116-
if: ${{ steps.check_pr_exists.outputs.pr_exists == 'false' }}
123+
if: ${{ steps.prepare_pr_message.outcome == 'success' && steps.check_pr_exists.outputs.pr_exists == 'false' }}
117124
env:
118125
# We cannot use default workflow's GITHUB_TOKEN here, because
119126
# it is restricted to not trigger 'pull_request' event that
@@ -133,7 +140,7 @@ jobs:
133140
134141
- name: Update PR
135142
id: update_pr
136-
if: ${{ steps.check_pr_exists.outputs.pr_exists == 'true' }}
143+
if: ${{ steps.prepare_pr_message.outcome == 'success' && steps.check_pr_exists.outputs.pr_exists == 'true' }}
137144
env:
138145
# We cannot use default workflow's GITHUB_TOKEN here, because
139146
# it is restricted to not trigger 'pull_request' event that

0 commit comments

Comments
 (0)