Skip to content

Restrict release workflow to the main branch - #288

Merged
glenn-jocher merged 3 commits into
mainfrom
publish-recovery
Jul 4, 2026
Merged

Restrict release workflow to the main branch#288
glenn-jocher merged 3 commits into
mainfrom
publish-recovery

Conversation

@glenn-jocher

@glenn-jocher glenn-jocher commented Jul 4, 2026

Copy link
Copy Markdown
Member

🛠️ Summary

Restricts the release workflow to the main branch by adding github.ref == 'refs/heads/main' to the check job condition.

Previously a workflow_dispatch run from a feature branch could tag and create a release from a commit that never landed on main (the checkout defaults to the dispatched ref). This guard closes that gap while leaving normal push-to-main and main dispatch behavior unchanged. Part of a cross-repo release-workflow hardening pass (see ultralytics/template#91).

🧪 Testing

  • YAML validated. Push-to-main and main-dispatch paths are unaffected; only non-main dispatch is now skipped.

🛠️ PR Summary

Made with ❤️ by Ultralytics Actions

🌟 Summary

Tightens the publish workflow so releases only run from the main branch of ultralytics/inference 🚀

📊 Key Changes

  • Updated the GitHub Actions publish.yml workflow condition.
  • The check job now runs only when:
    • The repository is ultralytics/inference
    • The Git ref is refs/heads/main

🎯 Purpose & Impact

  • Prevents publishing workflows from running on non-main branches 🛡️
  • Reduces the risk of accidental or premature releases 📦
  • Improves CI/CD safety and release control for maintainers ✅

@UltralyticsAssistant UltralyticsAssistant added enhancement New feature or request priority: low Low urgency; can wait behind higher-priority work. labels Jul 4, 2026
@UltralyticsAssistant

Copy link
Copy Markdown
Member

👋 Hello @glenn-jocher, thank you for submitting a ultralytics/inference 🚀 PR! This automated message is here to help ensure a seamless integration of your workflow change, and an Ultralytics engineer will assist as needed.

  • Define a Purpose: Clearly explain the purpose of your fix or feature in your PR description, and link to any relevant issues. Ensure your commit messages are clear, concise, and adhere to the project's conventions.
  • Synchronize with Source: Confirm your PR is synchronized with the ultralytics/inference main branch. If it's behind, update it by clicking the 'Update branch' button or by running git pull and git merge main locally.
  • Ensure CI Checks Pass: Verify all Ultralytics Continuous Integration (CI) checks are passing. If any checks fail, please address the issues.
  • Update Documentation: Update the relevant documentation for any new or modified features.
  • Add Tests: If applicable, include or update tests to cover your changes, and confirm that all tests are passing.
  • Sign the CLA: Please ensure you have signed our Contributor License Agreement if this is your first Ultralytics PR by writing "I have read the CLA Document and I sign the CLA" in a new message.
  • Minimize Changes: Limit your changes to the minimum necessary for your bug fix or feature addition. "It is not daily increase but daily decrease, hack away the unessential. The closer to the source, the less wastage there is." — Bruce Lee

For more guidance, please refer to our Contributing Guide. Don't hesitate to leave a comment if you have any questions. Thank you for contributing to Ultralytics! 🚀

@UltralyticsAssistant UltralyticsAssistant left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

🔍 PR Review

Made with ❤️ by Ultralytics Actions

No issues found. The workflow condition change is minimal and correctly restricts the publishing check job to the ultralytics/inference repository on the main branch.

@codecov

codecov Bot commented Jul 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@glenn-jocher
glenn-jocher merged commit 8216379 into main Jul 4, 2026
15 checks passed
@glenn-jocher
glenn-jocher deleted the publish-recovery branch July 4, 2026 19:05
@UltralyticsAssistant

Copy link
Copy Markdown
Member

🚀 Great to see this merged, @glenn-jocher!

“Plans are nothing; planning is everything.” — Dwight D. Eisenhower

This update strengthens our release planning by ensuring the publish workflow only runs from main in ultralytics/inference, reducing the risk of accidental releases and keeping CI/CD safer and more predictable. Thanks for tightening the guardrails and helping maintain a reliable path from code to release!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request priority: low Low urgency; can wait behind higher-priority work.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants