# Getting the label info on pull request labeled workflow

**URL:** <https://forum.gitea.com/t/getting-the-label-info-on-pull-request-labeled-workflow/9660>\
**Category:** Actions\
**Created:** [August 31, 2024, 3:00pm UTC](https://forum.gitea.com/t/getting-the-label-info-on-pull-request-labeled-workflow/9660 "2024-08-31T15:00:33Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![paan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/paan/32/6210_2.png) [@paan](https://forum.gitea.com/u/paan)\
**Post date:** [August 31, 2024, 3:00pm UTC](https://forum.gitea.com/t/getting-the-label-info-on-pull-request-labeled-workflow/9660/1 "2024-08-31T15:00:33Z")

</div>

I am trying to trigger some actions based on label of pull request.  
I am not sure how to retrieve the details of the label  
Here is a simplified action to illustrate and I expect that all these will show me some info about the labels but all i got is “1” in the output.

What am I doing wrong here? Thanks!

 ![Screenshot 2024-08-31 225831](https://us1.discourse-cdn.com/flex020/uploads/gitea/original/2X/a/ae08fba1e3e6c1f67616a6832f49ae66069b3d66.png)

```auto
name: Gitea Actions Demo
run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀
on:
  pull_request:
    types: [labeled]
jobs:
  Explore-Gitea-Actions:
    runs-on: ubuntu-latest
    steps:
     - run: echo "${{ gitea.event.label.name }}"
      - run: echo "${{ gitea.event.label.id }}"
      - run: echo "${{ gitea.event.label.description }}"
      - run: echo "${{ gitea.event.label.node_id }}"
      - run: echo "${{ gitea.event.label.color }}"
      - run: echo "${{ gitea.event.label.url }}"

```

A little more info: I checked on [Frequently Asked Questions of Gitea Actions | Gitea Documentation](https://docs.gitea.com/next/usage/actions/faq#what-workflow-trigger-events-does-gitea-support) and it listed labeled as one of the actions that is supported and compatible with github. The same actions work on github. (but with the variables being github.xx instead of gitea.xx of course )

---

<div class="post-metadata">

**Author:** ![paan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/paan/32/6210_2.png) [@paan](https://forum.gitea.com/u/paan)\
**Post date:** [August 31, 2024, 3:08pm UTC](https://forum.gitea.com/t/getting-the-label-info-on-pull-request-labeled-workflow/9660/2 "2024-08-31T15:08:07Z")

</div>

Ok, so I just realized that the 1 is just the line number. 😅  
That means that the echo is not printing anything.

---

<div class="post-metadata">

**Author:** ![mistershadow](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@mistershadow](https://forum.gitea.com/u/mistershadow)\
**Post date:** [September 12, 2024, 3:10pm UTC](https://forum.gitea.com/t/getting-the-label-info-on-pull-request-labeled-workflow/9660/3 "2024-09-12T15:10:56Z")

</div>

I run into the same issue. Did you find a solution for this?

---

<div class="post-metadata">

**Author:** ![paan](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/paan/32/6210_2.png) [@paan](https://forum.gitea.com/u/paan)\
**Post date:** [September 13, 2024, 12:48am UTC](https://forum.gitea.com/t/getting-the-label-info-on-pull-request-labeled-workflow/9660/5 "2024-09-13T00:48:30Z")

</div>

@mistershadow  
No I did not. I plan to try again (much) later. For now I’ve given up.  
Please do post here if you manage to get it working.

---

<div class="post-metadata">

**Author:** ![mistershadow](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@mistershadow](https://forum.gitea.com/u/mistershadow)\
**Post date:** [September 13, 2024, 6:27am UTC](https://forum.gitea.com/t/getting-the-label-info-on-pull-request-labeled-workflow/9660/6 "2024-09-13T06:27:22Z")

</div>

So, I guess I figured it out.

**${{ gitea.event.label.name }}**  
just isn’t enough to get the data you want. You actually need to use the following.

**${{ gitea.event.pull\_request.labels[0].name }}**

So, you first need to access the pull\_request object where you will find the labels array. With the code above you just get the first label. I don’t know if there’s a simple way to just iterate over all labels in case there’s more than one.  
I guess to better understand you can have a look at [Github - Webhook events and payloads](https://docs.github.com/en/webhooks/webhook-events-and-payloads).

 ![image](https://us1.discourse-cdn.com/flex020/uploads/gitea/original/2X/6/61b0921813a73f2408194fa6c82366ab18663f84.png)

 ![actions_pull_request](https://us1.discourse-cdn.com/flex020/uploads/gitea/original/2X/4/4933727655797119f6e13c323a897490b7c067d4.png)

---

<div class="post-metadata">

**Author:** ![MAkos](https://avatars.discourse-cdn.com/v4/letter/m/db5fbb/32.png) [@MAkos](https://forum.gitea.com/u/MAkos)\
**Post date:** [January 15, 2026, 1:17pm UTC](https://forum.gitea.com/t/getting-the-label-info-on-pull-request-labeled-workflow/9660/7 "2026-01-15T13:17:30Z")

</div>

I was running into the same problem and looking for a more elegant solution, and what I figured out after dumping **${{ gitea }}** ’s JSON content is as follows:

Gitea is secretly converting github action events into its own implementation, and converts **types: [labeled]** and **[unlabeled]** to a **label\_updated** action with a different webhook payload structure:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/gitea/original/2X/0/01edc7d322bd516088c13fe31a774aad83edf02c.png)

This event triggers both when adding or removing (disregarding types:[labeled] or [unlabeled]), and will run separately for each label, even when adding/removing multiple labels in a single user action.

In conclusion:  
In gitea instead of **${{ gitea.event.label.name }}** you have to use  
**${{** **gitea.event.changes.added\_labels[0].name }}** or  
**${{** **gitea.event.changes.removed\_labels[0].name }}** (in case of trying to imitate a types: [unlabel] action)
