Skip to content

ci: implement citest skip for push events [citest_skip]#201

Merged
richm merged 1 commit intomainfrom
ci-check-push-citest_skip
Feb 4, 2026
Merged

ci: implement citest skip for push events [citest_skip]#201
richm merged 1 commit intomainfrom
ci-check-push-citest_skip

Conversation

@richm
Copy link
Copy Markdown
Contributor

@richm richm commented Feb 4, 2026

Enhancement:

Reason:

Result:

Issue Tracker Tickets (Jira or BZ if any):

Summary by Sourcery

CI:

  • Extend the ansible-lint workflow condition so the job is skipped for pull requests with [citest_skip] in the title or for push events whose head commit message includes [citest_skip].

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai bot commented Feb 4, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Update the ansible-lint GitHub Actions workflow condition so that the job is skipped not only for pull requests with [citest_skip] in the title but also for push events whose head commit message contains [citest_skip].

File-Level Changes

Change Details Files
Broaden the conditional that determines whether the ansible-lint CI job runs to handle both pull_request titles and push commit messages with a [citest_skip] marker.
  • Replace the simple pull_request title check with a multi-line if expression using logical operators and parentheses.
  • Add a pull_request-specific branch that checks github.event.pull_request.title for the [citest_skip] marker.
  • Add a push-specific branch that checks github.event.push.head_commit.commit.message for the [citest_skip] marker.
  • Invert the combined condition so the job only runs when neither the pull_request title nor the push head commit message contains [citest_skip].
.github/workflows/ansible-lint.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 2 issues, and left some high level feedback:

  • The if condition appears to use incorrect context fields for GitHub Actions: github.event_type should be github.event_name, and for push events the commit message is available as github.event.head_commit.message rather than github.event.push.head_commit.commit.message.
  • Consider simplifying the multiline if expression (e.g., by extracting the skip logic into a reusable expression or using intermediate environment variables) to make the conditions easier to read and maintain.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The `if` condition appears to use incorrect context fields for GitHub Actions: `github.event_type` should be `github.event_name`, and for push events the commit message is available as `github.event.head_commit.message` rather than `github.event.push.head_commit.commit.message`.
- Consider simplifying the multiline `if` expression (e.g., by extracting the skip logic into a reusable expression or using intermediate environment variables) to make the conditions easier to read and maintain.

## Individual Comments

### Comment 1
<location> `.github/workflows/ansible-lint.yml:23-24` </location>
<code_context>
+  # or if this is a push and the head commit message contains [citest_skip]
   ansible_lint:
-    if: "!contains(github.event.pull_request.title, '[citest_skip]')"
+    if: |
+      !((github.event_type == "pull_request" && contains(github.event.pull_request.title, "[citest_skip]")) ||
+        (github.event_type == "push" && contains(github.event.push.head_commit.commit.message, "[citest_skip]")))
     runs-on: ubuntu-latest
</code_context>

<issue_to_address>
**issue (bug_risk):** Use `github.event_name` instead of `github.event_type` in workflow conditions.

`github.event_type` is not a valid GitHub Actions context field, so these conditions will never match and the job will always run. Please switch both checks to `github.event_name == 'pull_request'` and `github.event_name == 'push'` so the skip logic works as intended.
</issue_to_address>

### Comment 2
<location> `.github/workflows/ansible-lint.yml:24-25` </location>
<code_context>
   ansible_lint:
-    if: "!contains(github.event.pull_request.title, '[citest_skip]')"
+    if: |
+      !((github.event_type == "pull_request" && contains(github.event.pull_request.title, "[citest_skip]")) ||
+        (github.event_type == "push" && contains(github.event.push.head_commit.commit.message, "[citest_skip]")))
     runs-on: ubuntu-latest
     steps:
</code_context>

<issue_to_address>
**issue (bug_risk):** Correct the path to the commit message in the push event payload.

In `push` events the commit message is at `github.event.head_commit.message`; `github.event.push.head_commit.commit.message` doesn’t exist in the documented payload, so this condition will not work as intended. Please update the push branch to `contains(github.event.head_commit.message, "[citest_skip]")` to match the expected behavior.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@richm richm force-pushed the ci-check-push-citest_skip branch from 809a7ee to 9df6faa Compare February 4, 2026 01:41
@richm richm changed the title ci: implement citest skip for push events ci: implement citest skip for push events [citest_skip] Feb 4, 2026
@richm richm force-pushed the ci-check-push-citest_skip branch from 9df6faa to 71bf534 Compare February 4, 2026 01:43
Signed-off-by: Rich Megginson <rmeggins@redhat.com>
@richm richm force-pushed the ci-check-push-citest_skip branch from 71bf534 to 5d2125f Compare February 4, 2026 01:46
@richm richm merged commit 659bc0d into main Feb 4, 2026
10 checks passed
@richm richm deleted the ci-check-push-citest_skip branch February 4, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant