Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add workflow for checking if celery conf is updated in case of new migration tasks (#18668)

Iga Karbowiakf38e3d184a11
diff --git a/.github/workflows/check-migration-tasks.yml b/.github/workflows/check-migration-tasks.yml
new file mode 100644
index 0000000000..4184e2b736
--- /dev/null
+++ b/.github/workflows/check-migration-tasks.yml
@@ -0,0 +1,48 @@
+name: Check Migration Tasks Configuration
+
+on:
+ pull_request:
+ types: [opened, synchronize, reopened, labeled]
+
+jobs:
+ check-migration-tasks:
+ runs-on: ubuntu-latest
+ permissions:
+ contents: read
+ if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip celery check') }}
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Check for new tasks and celery config updates
+ shell: bash
+ run: |
+ # Fetch the base branch to ensure we can diff against it
+ git fetch origin ${{ github.base_ref }}
+
+ # List files added (A) in the PR relative to the base branch
+ ADDED_FILES=$(git diff --name-only --diff-filter=A origin/${{ github.base_ref }}...HEAD)
+
+ # List all changed files (A, M, R, etc) to check if celeryconf was touched
+ ALL_CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
+
+ # Check if any new python file was added in a *migrations/tasks/ directory
+ NEW_TASKS=$(echo "$ADDED_FILES" | grep -E "saleor/.*/migrations/tasks/.*\.py$" || true)
+
+ if [ -n "$NEW_TASKS" ]; then
+ echo "New migration task file(s) detected:"
+ echo "$NEW_TASKS"
+
+ # Check if celeryconf.py is in the list of all changed files
+ if echo "$ALL_CHANGED_FILES" | grep -q "saleor/celeryconf.py"; then
+ echo "✅ saleor/celeryconf.py was updated."
+ else
+ echo "❌ Error: New migration tasks were added, but saleor/celeryconf.py was not modified."
+ echo "Please ensure you have registered the new tasks in saleor/celeryconf.py."
+ exit 1
+ fi
+ else
+ echo "No new migration task files detected. Skipping celeryconf check."
+ fi