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: trigger on check #1018

Merged
merged 6 commits into from
Aug 11, 2023
Merged

feat: trigger on check #1018

merged 6 commits into from
Aug 11, 2023

Conversation

zolamk
Copy link
Contributor

@zolamk zolamk commented Aug 8, 2023

Description

Introduces ability to trigger workflows when an issue is found by a check.

Summary generated by Reviewpad on 11 Aug 23 18:47 UTC

This pull request includes the following changes:

  1. In the mocks.go file, a new nil element is added to a function call. This change does not seem to have a significant impact but may be necessary for the overall functionality of the code.

  2. The run.go file has been modified. On line 152, an additional argument nil is added to a function call to the reviewpad.Run function. These changes appear to be related to adjusting the parameters passed to the reviewpad.Run function.

  3. Multiple function calls in different test cases have been modified in the mocks_test.go file. Specifically, a nil parameter is added in the functions TestNewEvalEnv_WhenGetPullRequestFilesFails, TestNewEvalEnv_WhenNewFileFails, TestNewEvalEnv, and TestNewEvalEnv_WhenGetPullRequestFails.

  4. The exec.go file contains changes to the ExecConfigurationFile function. The changes introduce a check to determine if a workflow should run based on a triggering check. The function checks if any of the checks in checksWithIssues match the triggerOnCheck field of the workflow. If a match is found, the workflow should run; otherwise, it continues to the next workflow.

  5. The env.go file has a new method GetChecksWithIssues() added to the Interpreter interface.

  6. The loader.go file has changes in the transform function. The changes include adding a new field TriggerOnCheck to the transformedWorkflows struct in the append function call.

  7. In the integration_test.go file, on line 330, a new argument nil is added to the function reviewpad.Run().

  8. The inline_rules_normalizer.go file contains changes to the processWorkflow function. These changes include adding the field TriggerOnCheck to the wf struct initialization.

  9. The interpreter_internal_test.go file has changes related to adding nil values to the arguments of certain function calls in the test cases TestNewInterpreter_WhenNewEvalEnvFails, TestNewInterpreter, and TestReportMetric.

  10. The interpreter.go file introduces a new function GetChecksWithIssues() to retrieve a slice of strings. Additionally, the NewInterpreter function is modified to accept an additional parameter checksWithIssues of type []string.

  11. In the engine/lang.go file, a new field TriggerOnCheck is added to the PadWorkflow struct.

  12. The engine/exec_test.go file includes two changes. On line 444 and line 719, new nil values are added.

  13. The lang/type_internal_test.go file has test cases added for the Equals() function. These tests compare various types and assert that the Equals() function correctly identifies identical types.

  14. Changes in the runner.go file include a new parameter checksWithIssue added to the Run function. This parameter is used in the call to aladino.NewInterpreter. The aladino.NewInterpreter call is updated to include the checksWithIssue parameter.

  15. The env.go file introduces changes to the Env interface and the BaseEnv struct. The Env interface now includes a new method GetChecksWithIssues(), which returns a slice of strings. The BaseEnv struct includes a new field ChecksWithIssues of type []string. The GetChecksWithIssues() method is implemented in the BaseEnv struct to return the ChecksWithIssues field. The NewEvalEnv() function is also updated to receive a new parameter checksWithIssues of type []string and assign it to the ChecksWithIssues field of the BaseEnv struct.

Please review these changes and ensure they align with the requirements of the system.

🤖 Generated by Copilot at 05ba2b6

Add TriggerOnCheck field to PadWorkflow type to enable custom workflows based on checks. This change affects the engine/lang.go file.

Code review and merge strategy

Ship: this pull request can be automatically merged and does not require code review

<! -- Ask: this pull request requires a code review before merge -->

How

🤖 Generated by Copilot at 05ba2b6

  • Add a new field TriggerOnCheck to the PadWorkflow type to specify a check name that triggers the workflow execution (link)

@reviewpad reviewpad bot added the ship Pull request can be automatically merged and does not require code review label Aug 8, 2023
@reviewpad reviewpad bot added ask Pull request requires a code review before merge and removed ship Pull request can be automatically merged and does not require code review labels Aug 8, 2023
@zolamk zolamk marked this pull request as ready for review August 8, 2023 18:24
@reviewpad reviewpad bot added medium medium pull request critical Modifications to critical changes labels Aug 8, 2023
@reviewpad reviewpad bot requested a review from marcelosousa August 8, 2023 18:26
@reviewpad reviewpad bot added the waiting-approval Pull request is waiting for approval label Aug 8, 2023
ferreiratiago
ferreiratiago previously approved these changes Aug 11, 2023
@reviewpad
Copy link

reviewpad bot commented Aug 11, 2023

Pull request is not up to date with the base branch. Reviewpad will rebase it. After the rebase, please trigger Reviewpad by running the command /reviewpad run in a comment.

@reviewpad reviewpad bot force-pushed the feat/trigger-on-check branch from 16aeb65 to df840a4 Compare August 11, 2023 08:15
@zolamk
Copy link
Contributor Author

zolamk commented Aug 11, 2023

/reviewpad run

@reviewpad
Copy link

reviewpad bot commented Aug 11, 2023

Pull request is not up to date with the base branch. Reviewpad will rebase it. After the rebase, please trigger Reviewpad by running the command /reviewpad run in a comment.

@reviewpad reviewpad bot force-pushed the feat/trigger-on-check branch from df840a4 to b9bff55 Compare August 11, 2023 14:53
@zolamk
Copy link
Contributor Author

zolamk commented Aug 11, 2023

/reviewpad run

@reviewpad
Copy link

reviewpad bot commented Aug 11, 2023

Pull request is not up to date with the base branch. Reviewpad will rebase it. After the rebase, please trigger Reviewpad by running the command /reviewpad run in a comment.

@reviewpad reviewpad bot force-pushed the feat/trigger-on-check branch from b9bff55 to 166c10a Compare August 11, 2023 16:21
@zolamk
Copy link
Contributor Author

zolamk commented Aug 11, 2023

/reviewpad run

@reviewpad
Copy link

reviewpad bot commented Aug 11, 2023

Reviewpad Report

ℹ️ Messages

  • Reviewpad is waiting for all reviewers to approve it.

@reviewpad reviewpad bot added the ship Pull request can be automatically merged and does not require code review label Aug 11, 2023
Copy link

@reviewpad reviewpad bot left a comment

Choose a reason for hiding this comment

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

Pull request is in ship mode. Reviewpad will merge it.

@reviewpad reviewpad bot added this pull request to the merge queue Aug 11, 2023
Merged via the queue into main with commit 6019034 Aug 11, 2023
@ferreiratiago ferreiratiago deleted the feat/trigger-on-check branch August 18, 2023 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ask Pull request requires a code review before merge critical Modifications to critical changes medium medium pull request ship Pull request can be automatically merged and does not require code review waiting-approval Pull request is waiting for approval
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants