Skip to content

Unknown Member Boolean Cast Fix#30

Merged
jonhopper-dataengineers merged 2 commits into
mainfrom
feature/workflows
May 21, 2026
Merged

Unknown Member Boolean Cast Fix#30
jonhopper-dataengineers merged 2 commits into
mainfrom
feature/workflows

Conversation

@jonhopper-dataengineers

@jonhopper-dataengineers jonhopper-dataengineers commented May 21, 2026

Copy link
Copy Markdown
Member
  • Fixed unknown_member macro: added explicit ::boolean casts for is_current, is_deleted, and generic boolean columns to ensure correct type inference in Snowflake when generating unknown member rows.

Extracts version from dbt_project.yml on push to main, checks if the
tag already exists, and creates a GitHub release with changelog notes.

.... Generated with [Cortex Code](https://docs.snowflake.com/en/user-guide/cortex-code/cortex-code)

Co-Authored-By: Cortex Code <noreply@snowflake.com>
@sourcery-ai

sourcery-ai Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Adds a GitHub Actions workflow that, on pushes to main or manual dispatch, reads the dbt project version, checks for an existing git tag, extracts the corresponding changelog section, and creates a GitHub release using the GitHub CLI if the tag does not yet exist.

Sequence diagram for the new GitHub release workflow

sequenceDiagram
    actor Developer
    participant GitHubActions as GitHub_Actions_Workflow
    participant Git as git_repo
    participant Python as python_scripts
    participant GHCLI as gh_cli

    Developer->>GitHub_Actions_Workflow: push to main or workflow_dispatch
    GitHub_Actions_Workflow->>GitHub_Actions_Workflow: actions/checkout

    GitHub_Actions_Workflow->>Python: Extract version from dbt_project.yml
    Python-->>GitHub_Actions_Workflow: version output

    GitHub_Actions_Workflow->>Git: git rev-parse --verify refs/tags/version
    alt tag exists
        Git-->>GitHub_Actions_Workflow: tag found
        GitHub_Actions_Workflow->>GitHub_Actions_Workflow: skip Extract changelog for this version
        GitHub_Actions_Workflow->>GitHub_Actions_Workflow: skip Create GitHub release
    else tag does not exist
        Git-->>GitHub_Actions_Workflow: tag not found
        GitHub_Actions_Workflow->>Python: Extract changelog for this version
        Python-->>GitHub_Actions_Workflow: title and /tmp/release_notes.md
        GitHub_Actions_Workflow->>GHCLI: gh release create version
        GHCLI-->>GitHub_Actions_Workflow: GitHub release created
    end
Loading

File-Level Changes

Change Details Files
Introduce an automated tag-and-release GitHub Actions workflow driven by dbt_project.yml and CHANGELOG.md.
  • Add a workflow triggered on pushes to main and manual dispatch with contents: write permission.
  • Checkout the full git history and extract the project version from dbt_project.yml using a Python + PyYAML snippet.
  • Check for an existing git tag matching the extracted version and short-circuit the job when it is present to ensure idempotency.
  • Parse CHANGELOG.md with a Python script to isolate the section corresponding to the current version, deriving a release title and notes file.
  • Create a GitHub release via the gh CLI using the extracted version as the tag, the parsed title, and the generated notes file, targeting the current commit SHA.
.github/workflows/release.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@jonhopper-dataengineers jonhopper-dataengineers changed the title Add release workflow to auto-tag and create GitHub releases Unknown Member Boolean Cast Fix May 21, 2026

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • The Extract version from dbt_project.yml step assumes PyYAML is installed (import yaml), which is not guaranteed on GitHub-hosted runners; consider either adding an explicit installation step or parsing the version with a tool that’s already available (e.g., yq or simple grep/sed).
  • In the changelog extraction step, if the requested version header is missing from CHANGELOG.md the script will silently produce an empty title/notes; it would be safer to detect this case and fail the workflow with a clear error message rather than creating a release with incomplete metadata.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `Extract version from dbt_project.yml` step assumes PyYAML is installed (`import yaml`), which is not guaranteed on GitHub-hosted runners; consider either adding an explicit installation step or parsing the version with a tool that’s already available (e.g., `yq` or simple `grep/sed`).
- In the changelog extraction step, if the requested version header is missing from `CHANGELOG.md` the script will silently produce an empty title/notes; it would be safer to detect this case and fail the workflow with a clear error message rather than creating a release with incomplete metadata.

## Individual Comments

### Comment 1
<location path=".github/workflows/release.yml" line_range="21-26" />
<code_context>
+        with:
+          fetch-depth: 0
+
+      - name: Extract version from dbt_project.yml
+        id: version
+        run: |
+          VERSION=$(python3 -c "import yaml; print(yaml.safe_load(open('dbt_project.yml'))['version'])")
+          echo "version=$VERSION" >> "$GITHUB_OUTPUT"
+          echo "Detected version: $VERSION"
+
+      - name: Check if tag already exists
</code_context>
<issue_to_address>
**issue (bug_risk):** Avoid relying on an uninstalled PyYAML dependency on the runner

This step imports `yaml`, which depends on PyYAML and is not installed by default on `ubuntu-latest`, so the workflow can fail unless another step installs it. To make this more robust, either use a tool already available on the runner (e.g., `yq`, `grep`, `sed`) to read `dbt_project.yml`, or add an explicit step to install PyYAML before running this command.
</issue_to_address>

### Comment 2
<location path=".github/workflows/release.yml" line_range="39-48" />
<code_context>
+      - name: Extract changelog for this version
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Fail fast when the changelog entry for the version is missing

If `CHANGELOG.md` lacks a header for the detected version, this step will still succeed and produce an empty `TITLE`/release notes, resulting in a release with incomplete metadata. Consider checking `found == False` (or an empty `title`) and exiting with a non-zero status so the workflow fails when the changelog is not updated.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread .github/workflows/release.yml
Comment thread .github/workflows/release.yml
- Replace python3 yaml import with grep/sed to extract version from
  dbt_project.yml (PyYAML not guaranteed on ubuntu-latest runners)
- Add error check if version extraction fails
- Fail workflow with clear error if CHANGELOG.md has no entry for the
  detected version instead of silently creating an empty release

.... Generated with [Cortex Code](https://docs.snowflake.com/en/user-guide/cortex-code/cortex-code)

Co-Authored-By: Cortex Code <noreply@snowflake.com>
@jonhopper-dataengineers jonhopper-dataengineers merged commit 09c6e70 into main May 21, 2026
2 checks passed
@jonhopper-dataengineers jonhopper-dataengineers deleted the feature/workflows branch May 21, 2026 04:31
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.

1 participant