Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

action cannot be triggered when using on.pull_request #22958

Closed
Yiklek opened this issue Feb 17, 2023 · 5 comments · Fixed by #23037 or #23613
Closed

action cannot be triggered when using on.pull_request #22958

Yiklek opened this issue Feb 17, 2023 · 5 comments · Fixed by #23037 or #23613
Assignees
Labels
Milestone

Comments

@Yiklek
Copy link

Yiklek commented Feb 17, 2023

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

@Yiklek
Copy link
Author

Yiklek commented Feb 17, 2023

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

Match this:

case webhook_module.HookEventPullRequestSync:

image

@lunny
Copy link
Member

lunny commented Feb 17, 2023

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

@lunny lunny self-assigned this Feb 20, 2023
@lunny lunny added this to the 1.19.0 milestone Feb 20, 2023
@delvh delvh added the outdated/backport/v1.19 This PR should be backported to Gitea 1.19 label Feb 22, 2023
@delvh delvh modified the milestones: 1.19.0, 1.20.0 Feb 22, 2023
@lunny lunny removed the outdated/backport/v1.19 This PR should be backported to Gitea 1.19 label Feb 23, 2023
@lunny lunny modified the milestones: 1.20.0, 1.19.0 Feb 23, 2023
@vtolstov
Copy link

any progress on this issue?

lunny added a commit that referenced this issue Mar 14, 2023
…3037)

Follow #22680

Partially Fix #22958, on pull_request, `opened`, `reopened`,
`synchronize` supported, `edited` hasn't been supported yet because
Gitea doesn't trigger that events.

---------

Co-authored-by: yp05327 <576951401@qq.com>
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Mar 14, 2023
…-gitea#23037)

Follow go-gitea#22680

Partially Fix go-gitea#22958, on pull_request, `opened`, `reopened`,
`synchronize` supported, `edited` hasn't been supported yet because
Gitea doesn't trigger that events.

---------

Co-authored-by: yp05327 <576951401@qq.com>
lunny added a commit that referenced this issue Mar 15, 2023
…3037) (#23471)

Backport #23037 by @lunny

Follow #22680

Partially Fix #22958, on pull_request, `opened`, `reopened`,
`synchronize` supported, `edited` hasn't been supported yet because
Gitea doesn't trigger that events.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: yp05327 <576951401@qq.com>
@Yiklek
Copy link
Author

Yiklek commented 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 }}."

if convertFromGithubEvent(evt) != string(triggedEvent) {
return false
}

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

@ericLemanissier
Copy link
Contributor

Is there a workaround to build pull requests?

lunny added a commit that referenced this issue Mar 23, 2023
Follow #23037 
Fix [#22598
comment](#22958 (comment))

Workflows with `pull_request` trigger event can't be triggered by
`pull_request_sync` event. This PR adds the `canGithubEventMatch`
function to check if a Github event can match any Gitea event. If the
Github event matches a Gitea event, the related workflows should be
triggered.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
GiteaBot pushed a commit to GiteaBot/gitea that referenced this issue Mar 23, 2023
Follow go-gitea#23037 
Fix [go-gitea#22598
comment](go-gitea#22958 (comment))

Workflows with `pull_request` trigger event can't be triggered by
`pull_request_sync` event. This PR adds the `canGithubEventMatch`
function to check if a Github event can match any Gitea event. If the
Github event matches a Gitea event, the related workflows should be
triggered.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
5 participants