Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(tf): dont run pipelines on draft #8

Merged
merged 2 commits into from
Feb 24, 2025

Conversation

maciejlakomski
Copy link
Contributor

@maciejlakomski maciejlakomski commented Feb 24, 2025

https://github.com/Inetum-Poland/internal-terraform/issues/500

Description

Motivation and Context

How has this been tested?

Are there any related PR?

Types of changes

  • Bug fix / Chore (PATCH) (non-breaking change which fixes an issue or does not add functionality)
  • New feature (MINOR) (non-breaking change which adds functionality)
  • Breaking change (MAJOR) (fix or feature that would cause existing functionality to not work as expected)

Summary by CodeRabbit

  • New Features

    • Enhanced automation to trigger actions when pull requests are marked as ready for review.
    • Introduced a new verification workflow that activates on finalized pull request events.
  • Chores

    • Updated conditions to ensure that labeling, tagging, and verification tasks are performed only on non-draft pull requests.

@maciejlakomski maciejlakomski requested a review from a team as a code owner February 24, 2025 08:28
Copy link

coderabbitai bot commented Feb 24, 2025

Walkthrough

In this tale of continuous integration, modifications have been made to several GitHub Actions workflows. A new event, ready_for_review, has been ushered into the pull request triggers, and conditions have been wrought so that jobs proceed only when the pull request is not but a draft. The assign workflows now bestow labels and tags with this condition, while the verification workflows are augmented to trigger on additional pull request events. A fresh workflow now calls forth an external verification process upon pull requests targeting the main branch.

Changes

File(s) Change Summary
.../reusable_assign_label.yml, .../reusable_assign_tag.yml Added the ready_for_review event to the pull_request trigger and a conditional check (if: github.event.pull_request.draft == false) to execute the assign job for label or tag assignment.
.../reusable_verify.yml, .../reusable_verify_semantic_pr.yml Introduced the ready_for_review event (with additional events in one) to the pull_request trigger and added a condition to run the verify job only if the pull request is not draft.
.../semantic_pr.yml A new workflow triggered on pull request events (opened, reopened, synchronize, edited, ready_for_review) for the main branch; it invokes an external verification workflow under a non-draft condition and inherits necessary secrets.

Sequence Diagram(s)

sequenceDiagram
    participant PR as "Pull Request"
    participant GH as "GitHub Actions"
    participant Assign as "Assign Job"
    participant Verify as "Verify Job"
    participant Ext as "External Verify"

    PR->>GH: Submit event (e.g., ready_for_review)
    GH->>GH: Evaluate event type and check if PR is a draft
    alt PR is not draft
        GH->>Assign: Execute assign job (label/tag)
        GH->>Verify: Execute verify job
        GH->>Ext: Invoke external verification (semantic_pr workflow)
    else PR is draft
        GH-->>PR: Skip job execution
    end
Loading

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0cb73d8 and d2914dd.

📒 Files selected for processing (5)
  • .github/workflows/reusable_assign_label.yml (1 hunks)
  • .github/workflows/reusable_assign_tag.yml (1 hunks)
  • .github/workflows/reusable_verify.yml (1 hunks)
  • .github/workflows/reusable_verify_semantic_pr.yml (1 hunks)
  • .github/workflows/semantic_pr.yml (1 hunks)
🔇 Additional comments (10)
.github/workflows/semantic_pr.yml (2)

1-11: A Noble Invocation of Pull Request Events
Hark! The events that summon our workflow now include the revered ready_for_review alongside opened, reopened, synchronize, and edited. This enchantment ensures that the call to arms is heard only when the pull request is truly prepared for review rather than still in the mists of draft.


12-18: Guarding the Verify Quest with a Warden’s Check
Behold the verify job, for it is protected by a conditional enchantment: if: github.event.pull_request.draft == false. This ensures that only pull requests free from the taint of draft status embark upon the verification journey. Truly, a safeguard as steadfast as the walls of Minas Tirith.

.github/workflows/reusable_assign_tag.yml (2)

1-17: Extending the Summoning of Events
Lo, the pull request events have been enriched with the mention of ready_for_review, a clarion call that signifies a pull request ready to shed its draft guise. This addition is most welcome in our quest to restrain the pipelines from running on unready drafts.


18-22: A Vigilant Conditional for the Assign Quest
The conditional clause if: github.event.pull_request.draft == false at line 22 stands as a vigilant guardian, ensuring that the assignment task is undertaken only when the pull request is past its draft state. Such care aligns well with our noble objectives.

.github/workflows/reusable_assign_label.yml (2)

1-17: A Call to Label Only When the Quest is Bona Fide
The inclusion of ready_for_review in the list of pull request event types at line 16 bears the wisdom of preparing labels only for those pull requests that have matured beyond the preliminary draft. An assembly of events most fitting for our cause!


18-23: A Conditional Oath for the Labeling Journey
At line 22, the condition if: github.event.pull_request.draft == false is pronounced, ensuring that labeling does not commence for those unready drafts. This conditional oath fortifies our workflows with resolute intent.

.github/workflows/reusable_verify_semantic_pr.yml (2)

1-11: Enriching the Pull Request Chorus
The invocation of the ready_for_review event among others in lines 6–10 is a melodious addition, ensuring that the chorus of events sings only when aspirations have left the realm of drafts. This augments the workflow with a timely clarity.


12-18: A Stalwart Check Before the Verification Quest
The verify job at lines 12–18 now bears the sword of condition: if: github.event.pull_request.draft == false. This ward stands firm, ensuring that only pull requests that have shed their draft cloaks may proceed, thus preserving the sanctity of the verification operation.

.github/workflows/reusable_verify.yml (2)

1-13: A Harmonious Blend of Push and Pull Events
In this venerable workflow file, the union of push events and pull_request events—with an enriched list including ready_for_review—is a masterful symphony. The call to action now resounds with clarity and purpose, summoning only those pull requests that have truly come forth from the drafts.


16-22: The Final Ward Against Premature Execution
The verify job is well defended by the same timeless conditional: if: github.event.pull_request.draft == false at line 20. This clause is as steadfast as the Guard of the West, ensuring that no pipelines are set in motion until the pull request is ready to stand before the council of review. The inheritance of secrets is also most suitably maintained.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@maciejlakomski maciejlakomski added bumper:none No changes chore Build process or auxiliary tool changes labels Feb 24, 2025
coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 24, 2025
@maciejlakomski maciejlakomski merged commit 27240c4 into main Feb 24, 2025
7 checks passed
@maciejlakomski maciejlakomski deleted the feat/dont-run-workflows-draft branch February 24, 2025 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bumper:none No changes chore Build process or auxiliary tool changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant