go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
45.13k stars 5.49k forks source link

Act runner doesn't trigger the event #25093

Closed kamzata closed 1 year ago

kamzata commented 1 year ago

Description

I'm using Dokku and I'm trying to set up a CI/CD with Gitea. I implemented the Gitea actions following this article with act_runner version v0.1.8 and I tried to use the github-actions for Dokku. Therefore I created a simple workflow and it worked great. Then I created a review-app workflow as in this example which create and deploy an app on every pull request and here I find a issue: the app is correctly created on the pull request but it doesn't be destroyed when the pull request is closed or merged.

The act_runner logs says:

[deploy-on-pr/destroy_review_app] [DEBUG] evaluating expression 'github.event_name == 'pull_request' && github.event.action == 'closed''
[deploy-on-pr/destroy_review_app] [DEBUG] expression 'github.event_name == 'pull_request' && github.event.action == 'closed'' evaluated to 'false'
[deploy-on-pr/destroy_review_app] [DEBUG] Skipping job 'destroy_review_app' due to 'github.event_name == 'pull_request' && github.event.action == 'closed''

and when I'm closing the pull request nothing happen and even the act_runner logs don't add anything.

I talked with a dokku/github-action maintainer and he says it works using Github.

Gitea Version

Gitea version 1.19.3 built with GNU Make 4.1, go1.20.4 : bindata, sqlite, sqlite_unlock_notify

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

git version 2.34.1

Operating System

No response

How are you running Gitea?

act_runner version v0.1.8

Database

None

lunny commented 1 year ago

The default on:pull_request only trigger open, reopen, sync and I think it's the same as what Github does.

Zettat123 commented 1 year ago

Duplicate with act_runner #229

kamzata commented 1 year ago

The default on:pull_request only trigger open, reopen, sync and I think it's the same as what Github does.

Thanks but it didn't work. Nothing's changed. Same act_runner logs and same result.

---
name: 'deploy'

# yamllint disable-line rule:truthy
on:
  # onl run this workflow on pull request events
  pull_request:
      types: [opened, closed]

jobs:
  review_app:
    runs-on: ubuntu-latest
    # only run when a pull request is opened
    if: github.event_name == 'pull_request' && github.event.action == 'opened'
    steps:
      - name: Cloning repo
        uses: actions/checkout@v3
        with:
          fetch-depth: 0

      - name: Push to dokku
        uses: dokku/github-action@master
        with:
          # create a review app
          command: review-apps:create
          git_remote_url: 'ssh://dokku@dokku.me:22/appname'
          # specify a name for the review app
          review_app_name: review-appname-${{ github.event.pull_request.number }}
          ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}

  destroy_review_app:
    runs-on: ubuntu-latest
    # only run when a pull request is closed
    if: github.event_name == 'pull_request' && github.event.action == 'closed'
    steps:
      - name: Destroy the review app
        uses: dokku/github-action@master
        with:
          # destroy a review app
          command: review-apps:destroy
          git_remote_url: 'ssh://dokku@dokku.me:22/appname'
          # specify a name for the review app
          review_app_name: review-appname-${{ github.event.pull_request.number }}
          ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }}

As said, I talked with a dokku/github-action maintainer and he says the example works flawlessly using Github.

Zettat123 commented 1 year ago

Hi @kamzata , I can't reproduce this issue. The opened and closed types work fine in my tests.

Some questions:

  1. Where is the workflow file? In the base branch or the head branch?
  2. Have you tried creating a new pull request and closing it after updating the workflow file?
kamzata commented 1 year ago

Hi @kamzata , I can't reproduce this issue. The opened and closed types work fine in my tests.

Some questions:

  1. Where is the workflow file? In the base branch or the head branch?
  2. Have you tried creating a new pull request and closing it after updating the workflow file?

Yes, I have. It's in the head branch (test). Is that correct?

Please, check the recording.

Zettat123 commented 1 year ago

Ah, yes. Thanks for the video recording, I reproduced the issue. This is a bug from the Gitea side and I'll send a PR to fix it.

kamzata commented 1 year ago

Ah, yes. Thanks for the video recording, I reproduced the issue. This is a bug from the Gitea side and I'll send a PR to fix it.

Thank you. Do you know when the fix will be available in the next Gitea package in Debian repository?