Skip to content

fix: add dag-folder input and fix root-folder path matching#143

Open
daneeesh wants to merge 4 commits intoastronomer:mainfrom
daneeesh:daneeesh/fix-repo-structure-assumption
Open

fix: add dag-folder input and fix root-folder path matching#143
daneeesh wants to merge 4 commits intoastronomer:mainfrom
daneeesh:daneeesh/fix-repo-structure-assumption

Conversation

@daneeesh
Copy link
Copy Markdown

@daneeesh daneeesh commented Apr 3, 2026

Summary

Fixes two bugs in the git diff change detection logic that prevented users from upgrading past v0.4:

  • ./ prefix mismatch: root-folder: ./astro never matched git diff paths because git omits the ./ prefix. Normalizes root-folder (and the new dag-folder) by stripping ./ and trailing / before matching.
  • DAGs outside root-folder invisible to change detection: Repos where DAGs live outside root-folder in version control (e.g., at dags/ in the repo root, copied into root-folder at CI time) had their DAG changes silently ignored. Adds a new dag-folder input to specify where DAGs live in git for change detection.
  • Prefix collision in path matching: Switched from regex prefix matching (^"astro".*) to directory-exact matching ("$file" == "$ROOT_FOLDER"/*) so root-folder: astro no longer falsely matches astro-old/file.py. Applied consistently to root-folder, dag-folder, and DBT root-folder sections.

Fixes #103
Fixes #123

Usage for non-standard repo structures

# DAGs live at dags/ in repo root, Astro project at astro/
steps:
- name: Copy dags into astro folder
  run: cp -r dags astro/dags

- name: Deploy to Astro
  uses: astronomer/deploy-action@<version>
  with:
    root-folder: astro
    dag-folder: dags
    checkout: false
    deployment-id: <deployment-id>

Test plan

  • dag-folder-deploy-test: validates that dag-folder: dags correctly detects dags/exampledag.py as a DAG change and triggers DAG-only deploy
  • dag-folder-prefix-no-deploy-test: validates that dag-folder: dags does NOT match dags-old/exampledag.py (negative test for prefix collision)
  • Existing e2e tests pass unchanged (backward compatible — dag-folder defaults to empty)
  • Note: new e2e test jobs require Astronomer API tokens from secrets and need to be validated by a maintainer

🤖 Generated with Claude Code

The deploy action's git diff change detection had two bugs:
1. root-folder values with "./" prefix (e.g., "./astro") never matched
   git diff paths because git omits the "./" prefix
2. Repos where DAGs live outside root-folder in version control (e.g.,
   at "dags/" in the repo root, copied into root-folder at CI time)
   had their DAG changes silently ignored

This adds a `dag-folder` input that specifies where DAGs live in the
git repo for change detection purposes. Also normalizes root-folder
by stripping "./" prefix and trailing "/" before matching, and switches
from regex prefix matching to directory-exact matching to prevent
false positives (e.g., "astro" no longer matches "astro-old/").

Fixes astronomer#103
Fixes astronomer#123

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@daneeesh daneeesh requested a review from a team as a code owner April 3, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deploy Actions root path not accepting ./ prefix Unable to deploy dags in v0.9.0

1 participant