Skip to content

chore: Ability to run PR automations every time PR updates#35476

Merged
hetunandu merged 17 commits intoreleasefrom
chore/ci-test-auto-run
Aug 12, 2024
Merged

chore: Ability to run PR automations every time PR updates#35476
hetunandu merged 17 commits intoreleasefrom
chore/ci-test-auto-run

Conversation

@hetunandu
Copy link
Member

@hetunandu hetunandu commented Aug 7, 2024

Description

By changing the workflow trigger and the way to check for correct labels, we are trying to allow the PR integrations tests to run every time the PR is updated. That means, if you push changes, and the PR already has ok-to-test label, it will rerun the tests based on new changes

Automation

/ok-to-test tags="@tag.Sanity"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/10296910575
Commit: c59583b
Cypress dashboard.
Tags: @tag.Sanity
Spec:


Thu, 08 Aug 2024 06:32:48 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

  • New Features
    • Introduced a new job, checkTestLabel, to verify the presence of the "ok-to-test" label on pull requests.
    • Added a new job, mark-stale, to mark the Cypress status as stale when the label is absent.
  • Improvements
    • Updated the parse-tags job to run only after the checkTestLabel job, enhancing workflow control.
    • Modified the conditions for executing the parse-tags job based on the output of the checkTestLabel job.
  • Style
    • Minor formatting adjustments for job dependencies in the workflow.

@hetunandu hetunandu requested a review from sharat87 as a code owner August 7, 2024 07:23
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 7, 2024

Walkthrough

The recent modifications to the GitHub Actions workflow enhance control flow by introducing a new job called check-label. This job verifies the presence of the "ok-to-test" label on pull requests before allowing the parse-tags job to proceed. By establishing this dependency, the workflow ensures that tag parsing occurs only when the necessary label is present, improving efficiency and clarity in the CI/CD process.

Changes

Files Change Summary
.github/workflows/pr-automation.yml Added new job check-label to verify the "ok-to-test" label; introduced mark-stale job; modified parse-tags to depend on check-label. Updated conditional for parse-tags to utilize output from check-label.

Poem

In workflows where labels dance,
A check was added, giving chance.
Tags now parsed with care and glee,
Only if "ok-to-test" we see!
A flow so smooth, a task divine,
CI/CD, you truly shine! ✨


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Aug 7, 2024
@hetunandu hetunandu added ok-to-test Required label for CI and removed skip-changelog Adding this label to a PR prevents it from being listed in the changelog labels Aug 7, 2024
@github-actions github-actions bot added the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Aug 7, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 0b1bcf2 and 2e610cc.

Files selected for processing (1)
  • .github/workflows/pr-automation.yml (3 hunks)
Additional comments not posted (9)
.github/workflows/pr-automation.yml (9)

11-12: Good job defining the job runner.

The check-label job is correctly set to run on ubuntu-latest. This is a common and reliable choice.


14-15: Checkout code step is essential.

Ensuring the code is checked out is a necessary step for any subsequent operations.


17-31: Label check script is well-structured.

The script correctly checks for the "ok-to-test" label and sets the output accordingly. This ensures that the workflow only proceeds if the label is present.


33-35: Correct dependency and conditional check.

The parse-tags job correctly depends on the check-label job and includes a conditional check to ensure it only runs if the "ok-to-test" label is present.


51-51: Essential step to checkout the head commit.

Ensuring the head commit of the branch is checked out is crucial for the subsequent steps to operate on the correct codebase.


Line range hint 54-59: Reading tags from PR description is well-implemented.

Using a script to read tags from the PR description ensures that the workflow can dynamically adjust based on the tags present.


Line range hint 62-72: Dynamic matrix allocation based on tags.

The step correctly checks for the @tag.All tag and adjusts the matrix size accordingly. This ensures efficient resource allocation.


Line range hint 75-88: Informative test response step.

Updating the PR with a link to the workflow run provides clear feedback to the developers about the test status.


96-96: Correct dependency and conditional check for Cypress tests.

The perform-test job correctly depends on the parse-tags job and includes a conditional check to ensure it only runs if the previous steps are successful.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2e610cc and b655c2c.

Files selected for processing (1)
  • .github/workflows/pr-automation.yml (3 hunks)
Additional comments not posted (6)
.github/workflows/pr-automation.yml (6)

11-14: LGTM! The job structure is well-defined.

The check-label job is well-structured with appropriate steps and outputs.


36-38: LGTM! The job modifications are well-implemented.

The parse-tags job modifications ensure efficient workflow execution based on label verification.


Line range hint 99-104:
LGTM! The job structure is well-defined.

The perform-test job is well-structured with appropriate dependencies and steps for running Cypress tests.


Line range hint 99-104:
Verify the dependency and Cypress test execution.

Ensure that the dependency on parse-tags is correctly implemented and that the Cypress tests run as expected.


38-38: Verify the conditional execution logic.

Ensure that the conditional execution logic correctly evaluates the output from the check-label job.


19-34: Verify the correctness of the script logic.

The script correctly checks for the "ok-to-test" label and sets the output variable. Ensure that the label checking logic works as expected.

@hetunandu hetunandu removed the ok-to-test Required label for CI label Aug 7, 2024
@hetunandu hetunandu added the ok-to-test Required label for CI label Aug 7, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b655c2c and ff3edfd.

Files selected for processing (1)
  • .github/workflows/pr-automation.yml (4 hunks)
Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/pr-automation.yml

@hetunandu hetunandu removed the ok-to-test Required label for CI label Aug 7, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between ff3edfd and 165704c.

Files selected for processing (1)
  • .github/workflows/pr-automation.yml (3 hunks)
Additional comments not posted (3)
.github/workflows/pr-automation.yml (3)

11-35: Great job defining the checkTestLabel job!

The job correctly checks for the "ok-to-test" label and sets the ok_to_test output variable based on its presence. The logic and syntax are correct.


37-57: Well-structured mark-stale job!

The job correctly depends on the checkTestLabel job and runs only if the ok_to_test output is false. The script for marking the Cypress status as stale is used appropriately.


Line range hint 59-121:
Excellent parse-tags job definition!

The job correctly depends on the checkTestLabel job and runs only if the ok_to_test output is true. The steps for checking out the code, reading tags from the PR description, and updating the PR with run details are well-structured and logically sound.

@hetunandu hetunandu added the ok-to-test Required label for CI label Aug 7, 2024
@hetunandu hetunandu removed the ok-to-test Required label for CI label Aug 7, 2024
@nidhi-nair
Copy link
Contributor

Isn't this wasteful of CI resources @hetunandu ? We want to encourage developers to commit to remote as often as possible, even with broken builds. Why are we opting to occupy our runners unnecessarily? Perhaps we can think of a CLI option to mock the label removal and addition instead?

@hetunandu
Copy link
Member Author

@nidhi-nair this PR would only reduce the steps to test in my opinion. It solves these problems

  • It is still dependant on the dev input. Only when the label exists, it would trigger the cypress runs
  • It will automatically trigger the tests on new pushes. This is something that is anyways done manually by removing and adding labels.
  • Correctly marks the PR to be not ready to merge by marking the Cypress test results stale.

I am not sure how a CLI process to remove and add back the label would be any better?

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 165704c and c59583b.

Files selected for processing (1)
  • .github/workflows/pr-automation.yml (3 hunks)
Additional comments not posted (3)
.github/workflows/pr-automation.yml (3)

15-37: Great job on implementing the checkTestLabel job!

This job effectively checks for the "ok-to-test" label and sets the output correctly. This is a smart way to control the workflow based on PR labels.


39-60: Well done on the mark-stale job!

This job appropriately marks the Cypress status as stale when the "ok-to-test" label is missing. The use of a warning message keeps the PR status clear.


63-64: Nice update to the parse-tags job!

The dependency on checkTestLabel ensures that this job only runs when the PR is ready for testing. This is a good use of conditional logic to streamline the workflow.

@hetunandu hetunandu added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants