-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
ci: Fix Cypress test fail not reported for /test
command
#34278
Conversation
WalkthroughThese changes enhance the GitHub Actions workflow for pull requests by allowing them to trigger on multiple branches and simplifying tag parsing logic. The updates include branch listening expansion, conditional job execution, tag retrieval adjustments, and improved error handling. This results in a more streamlined and robust workflow. Changes
Sequence Diagram(s)sequenceDiagram
participant Developer
participant GitHub_Actions
participant Workflow
participant Job_ParseTags
participant FinalOutput
Developer->>GitHub_Actions: Create/Update PR
GitHub_Actions->>Workflow: Trigger on branch release/pg with label 'ok-to-test'
Workflow->>Job_ParseTags: Execute parseTags job if label is 'ok-to-test'
Job_ParseTags->>Workflow: Parse tags from PR description
Workflow->>FinalOutput: Output tags in the final step
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected. |
There was a problem hiding this 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
Outside diff range and nitpick comments (1)
.github/workflows/scripts/test-tag-parser.js (1)
Line range hint
23-81
: Review ofparseTags
Function
- Regex Usage: The use of regex for matching tags is effective. However, consider adding comments to explain complex regex patterns for maintainability.
- Error Handling: The function throws errors for unknown tags and when no tags are found, which is good for ensuring data integrity.
- Potential Improvement: The loops and conditions could be refactored into smaller, more testable functions to improve readability and maintainability.
+ // Refactor suggestion to improve readability + function validateTag(part, allTags) { + if (!allTags.includes(part)) { + throw new Error("Unknown tag: " + part); + } + } + // Use the new function in the loop + for (const part of parts) { + validateTag(part, allTags); + }
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- .github/workflows/pr-automation.yml (3 hunks)
- .github/workflows/scripts/test-tag-parser.js (2 hunks)
Additional comments not posted (3)
.github/workflows/scripts/test-tag-parser.js (1)
1-20
: Review of Main Module Export Function
- Error Handling: The use of
try-catch
blocks for error handling is appropriate here, ensuring that any parsing errors are caught and handled gracefully. However, the error message could be more descriptive about what went wrong.- Output Settings: The function sets outputs for both success and failure cases, which is good for clarity in CI logs.
- Comment on Line 19: The comment about removing code in a separate PR is a good practice to keep changes focused and manageable.
.github/workflows/pr-automation.yml (2)
5-7
: Review of Trigger Branches inon
Section
- Branches List: The addition of the 'pg' branch alongside 'release' allows for broader trigger coverage, aligning with the PR's intent to enhance CI operations across more branches.
14-14
: Review of Steps inparse-tags
Job
- Conditional Execution: The condition to only run the job if the 'ok-to-test' label is present is a good security measure to prevent unauthorized CI runs.
- Step Renaming: Renaming the step to 'Read tags from PR description' improves clarity on what the step does.
- Matrix Configuration: The dynamic configuration of the matrix based on the presence of '@tag.All' is a smart use of CI resources, scaling the test environment based on needs.
- Final Output: The use of dynamic tags in the final output step ensures that the workflow is responsive to the actual tags parsed, enhancing the accuracy of the CI process.
Also applies to: 32-32, 46-46, 62-62
/test
command
…rg#34278) Gets common validation code for tags, for both `/ok-to-test` and `/test` commands. Currently, for invalid tags in `/test` command, we aren't updating the PR description with details of the tag parsing failure. This PR fixes that, after finally bringing all the logic into Javascript needed to solve this. **/test sanity** <!-- This is an auto-generated comment: Cypress test results --> > [!TIP] > 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉 > Workflow run: <https://github.com/appsmithorg/appsmith/actions/runs/9715326227> > Commit: 260ec18 > <a href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=9715326227&attempt=1" target="_blank">Cypress dashboard</a>. > Tags: `` <!-- end of auto-generated comment: Cypress test results --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Chores** - Updated GitHub Actions workflow to trigger on 'release' and 'pg' branches for 'ok-to-test' labeled PRs. - Simplified tag parsing and validation logic in automation scripts. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Gets common validation code for tags, for both
/ok-to-test
and/test
commands. Currently, for invalid tags in/test
command, we aren't updating the PR description with details of the tag parsing failure. This PR fixes that, after finally bringing all the logic into Javascript needed to solve this./test sanity
Tip
🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9715326227
Commit: 260ec18
Cypress dashboard.
Tags: ``
Summary by CodeRabbit