Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@ concurrency:

jobs:
prepare:
# The workflow_run branches filter matches the head branch name, which a
# fork PR opened from its own `main` shares; only a push here may publish.
if: >-
github.repository == 'Tracer-Cloud/opensre' &&
(github.event_name != 'workflow_run' ||
github.event.workflow_run.conclusion == 'success')
(github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' &&
github.event.workflow_run.head_repository.full_name == github.repository))
runs-on: ubuntu-24.04
outputs:
channel: ${{ steps.meta.outputs.channel }}
Expand Down Expand Up @@ -81,6 +85,10 @@ jobs:
fi

if [ "$EVENT_NAME" = "workflow_run" ]; then
if ! git merge-base --is-ancestor "$source_sha" refs/remotes/origin/main; then
echo "Release source commit is not on main: ${source_sha}" >&2
exit 1
fi
released_sha="$(git rev-parse -q --verify "refs/tags/main-build^{commit}" || true)"
if [ -n "$released_sha" ]; then
if ! git merge-base --is-ancestor "$released_sha" "$source_sha"; then
Expand Down
3 changes: 0 additions & 3 deletions integrations/neon/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

from __future__ import annotations

import logging
import re
from http import HTTPStatus
from typing import Any
Expand All @@ -19,8 +18,6 @@
from integrations.neon.config import NeonConfig
from integrations.probes import ProbeResult

logger = logging.getLogger(__name__)

_MAX_PATH_SEGMENT_LEN = 128
# Neon project/branch IDs and bucket names are lowercase slugs: letters,
# digits, hyphens (bucket names may also hold dots). Reject anything else so a
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@ constraint-dependencies = [
"setuptools>=84.1.0",
# GHSA-45c3-73f7-pv4m (via pymongo).
"dnspython>=2.9.0",
# GHSA-3jp2-3mrg-2vxc (via kubernetes).
"oauthlib>=4.0.1",
]
# litellm caps filelock below 4, and GHSA-v4x8-3wr5-3wq8 (high), GHSA-9vhv-jxww-xfm5
# and GHSA-567q-5qvw-pf92 have no 3.x fix. 4.0 changed only SoftReadWriteLock's
Expand Down
7 changes: 7 additions & 0 deletions tests/packaging/test_release_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ def test_release_workflow_does_not_run_on_pull_requests() -> None:
assert 'echo "channel=pr" >> "$GITHUB_OUTPUT"' not in workflow
assert "opensre_pr_" not in workflow

# A fork PR from its own `main` passes the branches filter, so the CI run
# must also be a push to this repository and the commit must be on main.
prepare_if = yaml.load(workflow, Loader=yaml.BaseLoader)["jobs"]["prepare"]["if"]
assert "github.event.workflow_run.event == 'push'" in prepare_if
assert "github.event.workflow_run.head_repository.full_name == github.repository" in prepare_if
assert 'git merge-base --is-ancestor "$source_sha" refs/remotes/origin/main' in workflow
Comment on lines +173 to +176

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.

P2 Disabled guards still pass tests

The new assertions check only that guard text exists. They still pass if prepare.if gains || true, or if the ancestor check stops exiting on failure. A later edit could disable either release guard while these tests stay green.

Add cases that check the result for a fork PR, a same-repository push, and commits both on and outside main, using the actual workflow expression and shell block.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!



def test_release_workflow_does_not_publish_python_distributions_to_pypi() -> None:
raw = _RELEASE_WORKFLOW.read_text(encoding="utf-8")
Expand Down
19 changes: 10 additions & 9 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading