]> source.dussan.org Git - gitea.git/commit
Fix mismatch between hook events and github event types (#24048)
authorZettat123 <zettat123@gmail.com>
Wed, 12 Apr 2023 16:16:47 +0000 (00:16 +0800)
committerGitHub <noreply@github.com>
Wed, 12 Apr 2023 16:16:47 +0000 (12:16 -0400)
commit2d91afaa92609d31b04aea9ad909cec8a574cacd
treeb5a0aba7d4fc181a84a63707dc8eb657ee039517
parent53e324fd80fe08dc78f58fa4e0d98e02974cd18f
Fix mismatch between hook events and github event types (#24048)

Some workflow trigger events can have multiple activity types, such as
`issues` and `pull_request`, and user can specify which types can
trigger the workflow. See GitHub documentation:
https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows

Now some hook events cannot match the workflow trigger events correctly
because we don't check the activity types. For example,
`pull_request_label` is an individual hook event. But there isn't a
`pull_request_label` workflow trigger event, we can only use
`pull_request` event's `label` activity type. If we don't check the
activity types, the workflows without the `label` activity type may be
triggered by the `pull_request_label` event by mistake. We need to
improve the match logic.

- [x] [`issues`
](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issues)
- [x]
[`issue_comment`](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#issue_comment)
- [x]
[`pull_request`](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request)
- [x]
[`pull_request_review`](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_review)
- [x]
[`pull_request_review_comment`](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_review_comment)
- [x]
[`release`](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release)
- [x]
[`registry_package`](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#registry_package)
modules/actions/workflows.go
modules/actions/workflows_test.go [new file with mode: 0644]