Skip to content

Label added by GitStream rule isn't removed when the condition is no longer true #804

@echarrod

Description

@echarrod

Describe the bug

The add-label action is documented as a "managed" action that should automatically remove labels when their triggering conditions no longer apply. However, in practice, labels added by gitStream persist even after the conditions change. Specifically, our missing-jira label remains on MRs even after a Jira ticket link is added to the PR description.

To Reproduce

Steps to reproduce the behavior:

  1. The .cm automation file:
# -*- mode: yaml -*-

manifest:
  version: 1.0

automations:
  label_missing_jira_info:
    # Triggered for PRs that don't have a link to a Jira ticket in the PR description.
    if:
      - {{ not has.jira_ticket_in_desc }}
      - {{ not (branch.author | includes(term="RENOVATE")) }}
    run:
      - action: add-label@v1
        args:
          label: "missing-jira"
          color: 'F6443B'

has:
  jira_ticket_in_desc: {{ pr.description | includes(regex=r/atlassian.net\/browse\/\w+-\d+\b/) }}
  1. Example PR URLs demonstrating the issue:
  2. PR relevant content: All three MRs had Jira ticket links in their descriptions added (matching the regex pattern atlassian.net\/browse\/\w+-\d+\b) but still have the missing-jira label applied

Expected behavior

According to the gitStream documentation,

when a PR updates existing labels that were added by gitStream are re-evaluated and those that are not applicable are removed.

When a Jira link is added to the PR description, the condition {{ not has.jira_ticket_in_desc }} should evaluate to false, and gitStream should automatically remove the missing-jira label during re-evaluation.

These MRs all had commits pushed to them after too, and successful GitStream runs

Screenshots

Image
Image
Image

Additional context

  • This is an organization-level automation in the cm repository that applies to all connected repositories
  • Running gitStream Docker image version: v1.0.158
  • The automation uses the add-label@v1 action which is documented as a managed action
  • There is no remove-label action available in gitStream, so we rely on the documented managed behavior
  • This affects multiple repositories across the organization (android, ios, core, etc.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions