Skip to content

ci: restrict release workflow to main#2187

Merged
SharonHart merged 1 commit into
mainfrom
ronshakutai/safe-release
Jul 22, 2026
Merged

ci: restrict release workflow to main#2187
SharonHart merged 1 commit into
mainfrom
ronshakutai/safe-release

Conversation

@RonShakutai

Copy link
Copy Markdown
Contributor

Summary

Restricts the manually triggered release workflow to the main branch.

workflow_dispatch allows users to select the ref from which the workflow runs. Previously, selecting another branch or tag could publish Python packages and container images built from code that had not been merged into main.

This change adds an early validation step to the get-version job. The workflow fails before checkout and version extraction when the selected ref is not refs/heads/main.

Since all publishing jobs depend directly or indirectly on get-version, the validation prevents:

  • Creating a GitHub release from a non-main ref
  • Publishing packages to PyPI from a non-main ref
  • Publishing container images to GHCR from a non-main ref

Testing

  • A workflow dispatched from main proceeds normally.
  • A workflow dispatched from another branch or tag fails during the Validate release branch step before any artifacts are published.

Copilot AI review requested due to automatic review settings July 22, 2026 08:35
@github-actions

Copy link
Copy Markdown
Contributor

Coverage report (presidio-structured)

This PR does not seem to contain any modification to coverable code.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage report (presidio-cli)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  presidio-cli/presidio_cli
  cli.py
Project Total  

This report was generated by python-coverage-comment-action

@github-actions

Copy link
Copy Markdown
Contributor

Coverage report (presidio-anonymizer)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  presidio-anonymizer/presidio_anonymizer
  __init__.py
  anonymizer_engine.py
  presidio-anonymizer/presidio_anonymizer/operators
  custom.py
Project Total  

This report was generated by python-coverage-comment-action

Copilot AI 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.

Pull request overview

This PR hardens the manual release workflow by ensuring releases can only be initiated from the main branch, preventing accidental publishing (GitHub releases, PyPI packages, and GHCR images) from unmerged branches or tags.

Changes:

  • Adds an early “Validate release branch” step in the get-version job which fails the workflow when github.ref is not refs/heads/main.
  • Ensures the workflow fails before checkout/version extraction, and blocks all downstream publishing jobs via the existing needs: get-version dependency chain.

@github-actions

Copy link
Copy Markdown
Contributor

Coverage report (presidio-image-redactor)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  presidio-image-redactor/presidio_image_redactor
  dicom_image_pii_verify_engine.py
  document_intelligence_ocr.py
  image_analyzer_engine.py
Project Total  

This report was generated by python-coverage-comment-action

@github-actions

Copy link
Copy Markdown
Contributor

Coverage report (presidio-analyzer)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  presidio-analyzer/presidio_analyzer
  analyzer_engine.py
  entity_recognizer.py
  presidio-analyzer/presidio_analyzer/context_aware_enhancers
  lemma_context_aware_enhancer.py
  presidio-analyzer/presidio_analyzer/input_validation
  schemas.py
  yaml_recognizer_models.py
  presidio-analyzer/presidio_analyzer/nlp_engine
  __init__.py
  nlp_engine_provider.py
  presidio-analyzer/presidio_analyzer/predefined_recognizers
  __init__.py
  presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific
  __init__.py
  presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/finland
  fi_personal_identity_code_recognizer.py
  presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/germany
  de_bsnr_recognizer.py
  de_id_card_recognizer.py
  de_lanr_recognizer.py
  de_passport_recognizer.py
  de_social_security_recognizer.py
  de_tax_id_recognizer.py
  de_vat_id_recognizer.py
  presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/india
  in_vehicle_registration_recognizer.py
  presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/poland
  pl_pesel_recognizer.py
  presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/singapore
  sg_uen_recognizer.py
  presidio-analyzer/presidio_analyzer/predefined_recognizers/country_specific/us
  us_ssn_recognizer.py
  presidio-analyzer/presidio_analyzer/predefined_recognizers/generic
  phone_recognizer.py
  presidio-analyzer/presidio_analyzer/recognizer_registry
  recognizer_registry.py
  recognizer_registry_provider.py
  recognizers_loader_utils.py
Project Total  

The report is truncated to 25 files out of 72. To see the full report, please visit the workflow summary page.

This report was generated by python-coverage-comment-action

@RonShakutai
RonShakutai requested a review from SharonHart July 22, 2026 08:40
@SharonHart
SharonHart merged commit 4d6b108 into main Jul 22, 2026
40 checks passed
@SharonHart
SharonHart deleted the ronshakutai/safe-release branch July 22, 2026 08:44
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.

3 participants