Skip to content

feat: ignored_checks #337

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

Merged
merged 8 commits into from
Dec 11, 2024
Merged

feat: ignored_checks #337

merged 8 commits into from
Dec 11, 2024

Conversation

GrantBirki
Copy link
Member

@GrantBirki GrantBirki commented Dec 10, 2024

Filtering CI Checks

This pull request does the following:

  • Adds a new input option called ignored_checks which accepts a comma separated list of checks that will be ignored when determining if a deployment can continue.
  • Updates the checks input option to support more than just all or required. You can now pass in a comma separated list of CI job names to explicitly include as required checks from this Action's point of view.

Read through the related issue to get even more context around these changes

related: #321

Examples 📸

Adding Custom checks with no ignored_checks and a check fails

Configuration:

- uses: github/branch-deploy@ignored-contexts
  id: branch-deploy
  with:
      checks: 'test1,test3' # we only care about the checks named `test1` and `test3`
      ignored_checks: '' # no checks are allowed to be ignored explicitly

Result:

Screenshot 2024-12-10 at 3 36 17 PM

Adding Custom checks with no ignored_checks and it passes

Configuration:

- uses: github/branch-deploy@ignored-contexts
  id: branch-deploy
  with:
      checks: 'test1' # we only care about the check named `test1`
      ignored_checks: '' # no checks are allowed to be ignored explicitly

Result:

Screenshot 2024-12-10 at 3 38 43 PM

No Custom checks but multiple ignored_checks and it passes

This example shows how to use ignored_checks to ignore a certain check. This will allow for deployments even if a check is required via branch protection settings for merging.

Configuration:

- uses: github/branch-deploy@ignored-contexts
  id: branch-deploy
  with:
      ignored_checks: 'test2,test3' # these two checks are ignored and deployment will be allowed even if they are failing

Result:

Screenshot 2024-12-10 at 3 41 52 PM

@GrantBirki GrantBirki self-assigned this Dec 10, 2024
@GrantBirki GrantBirki marked this pull request as ready for review December 11, 2024 00:11
@Copilot Copilot AI review requested due to automatic review settings December 11, 2024 00:11
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 10 out of 15 changed files in this pull request and generated no suggestions.

Files not reviewed (5)
  • tests/functions/help.test.js: Evaluated as low risk
  • tests/functions/post-deploy.test.js: Evaluated as low risk
  • tests/main.test.js: Evaluated as low risk
  • tests/schemas/action.schema.yml: Evaluated as low risk
  • action.yml: Evaluated as low risk
Comments skipped due to low confidence (3)

src/functions/prechecks.js:223

  • The closing brace for the if statement is missing, which could lead to incorrect logic execution.
commitStatus = 'skip_ci'

src/functions/prechecks.js:248

  • The variable 'commitStatus' is being assigned directly from the GraphQL result without filtering out ignored checks. This could lead to incorrect deployment status if ignored checks are present.
commitStatus = result.repository.pullRequest.commits.nodes[0].commit.statusCheckRollup.state

src/functions/inputs.js:67

  • The 'validateInput' function call should be outside the conditional block to ensure 'checks' input is always validated, whether it's a string or an array.
if (checks === 'all' || checks === 'required') {

Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more

@GrantBirki GrantBirki added the enhancement New feature or request label Dec 11, 2024
@GrantBirki GrantBirki merged commit 1305657 into main Dec 11, 2024
4 checks passed
@GrantBirki GrantBirki deleted the ignored-contexts branch December 11, 2024 18:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant