Skip to content

Conversation

@Sumit189
Copy link
Contributor

This pull request updates the handling of issue label events in workflows to distinguish between label additions and deletions, introduces corresponding test cases, and extends the IssuePayload structure to support this functionality.

Enhancements to issue label event handling:

  • Updated matchIssuesEvent in modules/actions/workflows.go to differentiate between "labeled" and "unlabeled" events based on whether labels were added or removed.
  • Added a new field, RemovedLabels, to the IssuePayload struct in modules/structs/hook.go to track labels that were removed during an issue event.

Testing improvements:

  • Added TestMatchIssuesEvent in modules/actions/workflows_test.go to cover scenarios such as label addition, label deletion, and label clearing, ensuring the correct event type is triggered.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Apr 29, 2025
@github-actions github-actions bot added the modifies/go Pull requests that update Go code label Apr 29, 2025
@Sumit189 Sumit189 changed the title [Fix] Trigger 'unlabeled' event when label is removed from PR [Fix] Trigger 'unlabeled' event when label is Deleted from PR Apr 29, 2025
@lunny lunny added type/bug backport/v1.24 This PR should be backported to Gitea 1.24 labels Apr 29, 2025
@lunny lunny added this to the 1.25.0 milestone Apr 29, 2025
@lunny
Copy link
Member

lunny commented Apr 29, 2025

The change in method func (n *actionsNotifier) IssueChangeLabels missed.

@Sumit189
Copy link
Contributor Author

The change in method func (n *actionsNotifier) IssueChangeLabels missed.

I made changes in the relevant methods, but I'm not sure how to test those changes. @lunny, can you help validate this?

@lunny
Copy link
Member

lunny commented Apr 29, 2025

The change in method func (n *actionsNotifier) IssueChangeLabels missed.

I made changes in the relevant methods, but I'm not sure how to test those changes. @lunny, can you help validate this?

You could create an integration test for this, there are mock runners and you can find some examples.

@lunny lunny added type/enhancement An improvement of existing functionality and removed type/bug backport/v1.24 This PR should be backported to Gitea 1.24 labels Jun 9, 2025
@github-actions github-actions bot added modifies/translation topic/code-linting modifies/api This PR adds API routes or modifies them modifies/cli PR changes something on the CLI, i.e. gitea doctor or gitea admin labels Sep 8, 2025
@github-actions github-actions bot removed modifies/translation topic/code-linting modifies/api This PR adds API routes or modifies them modifies/cli PR changes something on the CLI, i.e. gitea doctor or gitea admin modifies/templates This PR modifies the template files modifies/docs modifies/migrations modifies/internal modifies/dependencies modifies/frontend docs-update-needed The document needs to be updated synchronously labels Sep 8, 2025
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Sep 8, 2025
@lunny
Copy link
Member

lunny commented Sep 17, 2025

last call @go-gitea/technical-oversight-committee

@lunny lunny merged commit f09bea7 into go-gitea:main Sep 24, 2025
25 of 26 checks passed
darren pushed a commit to darren/gitea that referenced this pull request Sep 25, 2025
…ea#34316)

This pull request updates the handling of issue label events in
workflows to distinguish between label additions and deletions,
introduces corresponding test cases, and extends the `IssuePayload`
structure to support this functionality.

### Enhancements to issue label event handling:
* Updated `matchIssuesEvent` in `modules/actions/workflows.go` to
differentiate between "labeled" and "unlabeled" events based on whether
labels were added or removed.
* Added a new field, `RemovedLabels`, to the `IssuePayload` struct in
`modules/structs/hook.go` to track labels that were removed during an
issue event.

### Testing improvements:
* Added `TestMatchIssuesEvent` in `modules/actions/workflows_test.go` to
cover scenarios such as label addition, label deletion, and label
clearing, ensuring the correct event type is triggered.

---------

Co-authored-by: Lunny Xiao <[email protected]>
rossigee pushed a commit to rossigee/gitea that referenced this pull request Sep 26, 2025
…ea#34316)

This pull request updates the handling of issue label events in
workflows to distinguish between label additions and deletions,
introduces corresponding test cases, and extends the `IssuePayload`
structure to support this functionality.

### Enhancements to issue label event handling:
* Updated `matchIssuesEvent` in `modules/actions/workflows.go` to
differentiate between "labeled" and "unlabeled" events based on whether
labels were added or removed.
* Added a new field, `RemovedLabels`, to the `IssuePayload` struct in
`modules/structs/hook.go` to track labels that were removed during an
issue event.

### Testing improvements:
* Added `TestMatchIssuesEvent` in `modules/actions/workflows_test.go` to
cover scenarios such as label addition, label deletion, and label
clearing, ensuring the correct event type is triggered.

---------

Co-authored-by: Lunny Xiao <[email protected]>
zjjhot added a commit to zjjhot/gitea that referenced this pull request Sep 29, 2025
* commit '53dfbbb2eee5f9ae7b1a127b51fd9ab5accf5e89':
  Update issue.go with labels documentation (labels content, not ids) (go-gitea#35522)
  Fix markup init after issue comment editing (go-gitea#35536)
  [Fix] Trigger 'unlabeled' event when label is Deleted from PR (go-gitea#34316)
  [skip ci] Updated translations via Crowdin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/need 1 This PR needs approval from one additional maintainer to be merged. modifies/go Pull requests that update Go code type/enhancement An improvement of existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants