${{CF_PULL_REQUEST_LABELS}} not working?


I have setup a pull request in github, and assigned it a label. I’m trying to inspect the content of the ${{CF_PULL_REQUEST_LABELS}} variable using the following test step:

    stage: build
    title: "TESTING"
    image: bash
      - echo "HELLO TESTING"

The result I get from codefresh running this step is:

Executing command: echo "HELLO TESTING"                                                                                                                          
HELLO TESTING                                                                                                                                                    
Executing command: echo $CF_PULL_REQUEST_LABELS                                                                                                                  
Successfully ran freestyle step: TESTING          

It seems the ${{CF_PULL_REQUEST_LABELS}} variable is empty, whereas I would expect it to contain a list of strings corresponding to the github labels. Am I misunderstanding how ${{CF_PULL_REQUEST_LABELS}} is supposed to work?

Thank you


No you are right. This is how it should work.
All variables like this are coming directly from Github. You need to verify that they are actually sent to Codefresh.

First of all make sure that you are actually running the pipeline with a pull request trigger (i.e. it runs when a PR actually exists). I have a feeling that it might not work for plain commits.

If you have already done that, then try to see the webhook contents as sent by Github to verify that indeed the labels are sent to Codefresh.

If you have already done this as well (or don’t want to spend any time searching yourself) please open a ticket with us and include the URL of the build that has the issue and if possible the webhook contents and our support team will investigate to see if we have an issue on our side.

I hope that helps

Thanks for your reply Kostis.

The trigger I was testing on was of the type “Push commits”, CF_PULL_REQUEST_LABELS doesn’t get populated in that case. I tested with the “Pull request labeled” option, in that case it does get populated. In both cases, a label is being applied in github on a PR, so it feels like CF_PULL_REQUEST_LABELS should be populated in both cases. The use case for this is that I want to set a label to be able to skip certains steps of a pipeline with a “Push commits” trigger, which doesn’t seem possible since the pull request labels variable is not populated for that trigger type.

As a separate, but related question, is it possible to have a “Pull request labeled” trigger only trigger if the labels match a certain pattern? Currently this type of trigger will trigger regardless of which label is applied, and it seems that in order to run / skip steps based on the specific label that was applied, you need to use the conditional execution of steps codefresh mechanism, is that correct?


Regarding your first point, we don’t have control over what information is coming from Github. You can see yourself what is being sent to Codefresh from your Github UI. Go to the settings, select webhooks and click on recent deliveries. If pull request labels are not sent in plain commits, then I fear that we need a feature request on our side to try to implement missing information.

Regarding your second point, yes your understanding is correct. You can open a ticket with us as feature request, if you want to see the capability implemented it and we will plan it accordingly.