action cannot be triggered when using on.pull_request #10290

Closed
opened 2025-11-02 09:03:19 -06:00 by GiteaMirror · 5 comments
Owner

Originally created by @Yiklek on GitHub (Feb 17, 2023).

Originally assigned to: @lunny on GitHub.

Description

Action cannot be triggered when using on.pull_request.

New pr can trigger this action.

But push to pr source branch cannot trigger it.

Github can trigger it.

# .gitea/workflows/build.yaml
name: Gitea Actions Demo
run-name: ${{ github.actor }} is testing out Gitea Actions 🚀
on:
  pull_request:
    types: [opened, edited, synchronize, reopened]
jobs:
  Explore-Gitea-Actions:
    runs-on: ubuntu-latest
    steps:
      - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
      - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
      - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
      - name: Check out repository code
        uses: actions/checkout@v3
      - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
      - run: echo "🖥️ The workflow is now ready to test your code on the runner."
      - name: List files in the repository
        run: |
          ls ${{ github.workspace }}
      - run: echo "🍏 This job's status is ${{ job.status }}."

Gitea Version

ca445c

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

build Gitea myself
run from command-line

Database

SQLite

Originally created by @Yiklek on GitHub (Feb 17, 2023). Originally assigned to: @lunny on GitHub. ### Description Action cannot be triggered when using `on.pull_request`. New pr can trigger this action. But push to pr source branch cannot trigger it. Github can trigger it. ```yaml # .gitea/workflows/build.yaml name: Gitea Actions Demo run-name: ${{ github.actor }} is testing out Gitea Actions 🚀 on: pull_request: types: [opened, edited, synchronize, reopened] jobs: Explore-Gitea-Actions: runs-on: ubuntu-latest steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - name: Check out repository code uses: actions/checkout@v3 - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - run: echo "🖥️ The workflow is now ready to test your code on the runner." - name: List files in the repository run: | ls ${{ github.workspace }} - run: echo "🍏 This job's status is ${{ job.status }}." ``` ### Gitea Version ca445c ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? build Gitea myself run from command-line ### Database SQLite
GiteaMirror added the type/bug label 2025-11-02 09:03:19 -06:00
Author
Owner

@Yiklek commented on GitHub (Feb 17, 2023):

The backend receives a pull_request_sync event. It doesn't match the pull_request

Match this:
ca445cf566/modules/actions/workflows.go (L208)

image

@Yiklek commented on GitHub (Feb 17, 2023): The backend receives a `pull_request_sync` event. It doesn't match the `pull_request` Match this: https://github.com/go-gitea/gitea/blob/ca445cf56628274ab5119816bf988f04204035a3/modules/actions/workflows.go#L208 ![image](https://user-images.githubusercontent.com/21033316/219653096-d7a5c1b1-82d8-4fa5-979d-dd66669e601e.png)
Author
Owner

@lunny commented on GitHub (Feb 17, 2023):

Ah, yes. We need a event convertion from Gitea's to Github's.

@lunny commented on GitHub (Feb 17, 2023): Ah, yes. We need a event convertion from Gitea's to Github's.
Author
Owner

@vtolstov commented on GitHub (Mar 14, 2023):

any progress on this issue?

@vtolstov commented on GitHub (Mar 14, 2023): any progress on this issue?
Author
Owner

@Yiklek commented on GitHub (Mar 20, 2023):

@lunny hi, I find it doesn't work yet.

# .gitea/workflows/build.yaml
name: Gitea Actions Demo
run-name: ${{ github.actor }} is testing out Gitea Actions 🚀
on:
  pull_request:
    types: [opened, synchronize, reopened]
jobs:
  Explore-Gitea-Actions:
    runs-on: ubuntu-latest
    steps:
      - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
      - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!"
      - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
      - name: Check out repository code
        uses: actions/checkout@v3
      - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
      - run: echo "🖥️ The workflow is now ready to test your code on the runner."
      - name: List files in the repository
        run: |
          ls ${{ github.workspace }}
      - run: echo "🍏 This job's status is ${{ job.status }}."

ccd3a55bf4/modules/actions/workflows.go (L102-L104)

In this case, convertFromGithubEvent(evt) always return pull_request, but string(triggedEvent) is pull_request_sync.

@Yiklek commented on GitHub (Mar 20, 2023): @lunny hi, I find it doesn't work yet. ``` # .gitea/workflows/build.yaml name: Gitea Actions Demo run-name: ${{ github.actor }} is testing out Gitea Actions 🚀 on: pull_request: types: [opened, synchronize, reopened] jobs: Explore-Gitea-Actions: runs-on: ubuntu-latest steps: - run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event." - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}." - name: Check out repository code uses: actions/checkout@v3 - run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner." - run: echo "🖥️ The workflow is now ready to test your code on the runner." - name: List files in the repository run: | ls ${{ github.workspace }} - run: echo "🍏 This job's status is ${{ job.status }}." ``` https://github.com/go-gitea/gitea/blob/ccd3a55bf4f07a390e13d48100c58fb937fd3dcf/modules/actions/workflows.go#L102-L104 In this case, `convertFromGithubEvent(evt)` always return `pull_request`, but `string(triggedEvent)` is `pull_request_sync`.
Author
Owner

@ericLemanissier commented on GitHub (Mar 21, 2023):

Is there a workaround to build pull requests?

@ericLemanissier commented on GitHub (Mar 21, 2023): Is there a workaround to build pull requests?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10290