Skip to content

How to make conditional check on a label name that includes emoji #441

@guardrex

Description

@guardrex

On the Microsoft ASP.NET Core documentation repo, we use a label with a watch emoji (:watch:, ⌚) in our not-triaged label.

The label is ...

⌚ Not Triaged

When we try to make a conditional check for the watch emoji in a workflow that removes this label under some conditions based on the presence of other labels, either the emoji in the check fails to match or throws a syntax error.

Here are the two cases that we've tried ...

Using colon syntax

if: github.event.label.name == ':watch: Not Triaged' && (github.event.label.name == 'aspnetcore-blazorhybrid/tech' || github.event.label.name == 'aspnetcore-blazor/tech')

Result: The line throws a syntax error in the GH code editor ...

incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line

The workflow error when this is executed is ...

Invalid workflow file

You have an error in your yaml syntax on line 104

I tried escaping the colons with backslashes, and I also tried using the ${{ ... }} syntax around the conditional expression. Neither approach works.

Using the graphic emoji

if: github.event.label.name == '⌚ Not Triaged' && (github.event.label.name == 'aspnetcore-blazorhybrid/tech' || github.event.label.name == 'aspnetcore-blazor/tech')

Result: Doesn't throw a syntax error, nor does it cause the workflow to log an error when it runs. However, it fails to match on the label name, so the workflow job fails to execute our script.

How can we address this?

Is there an approach to deal with this? Is this a bug in your processing that you'd like to fix? If it is a bug that will be fixed, is there a workaround approach that I can use in the meantime?

If this isn't a bug, documentation for if: syntax probably should explain how to address it at ...

https://docs.github.com/en/actions/using-jobs/using-conditions-to-control-job-execution

Cross-reference to our entire workflow script: https://github.com/dotnet/AspNetCore.Docs/blob/main/.github/workflows/issue-processing.yml

☝️ See Line 104 of the workflow, which doesn't throw a syntax error but doesn't work.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionA question on how to use this action

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions