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

Act runner doesn't trigger the event #25093

Closed
kamzata opened this issue Jun 6, 2023 · 7 comments · Fixed by #25144
Closed

Act runner doesn't trigger the event #25093

kamzata opened this issue Jun 6, 2023 · 7 comments · Fixed by #25144
Assignees
Labels
topic/gitea-actions related to the actions of Gitea type/bug

Comments

@kamzata
Copy link

kamzata commented Jun 6, 2023

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
Copy link
Member

lunny commented Jun 6, 2023

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

@Zettat123
Copy link
Contributor

Duplicate with act_runner #229

@a1012112796 a1012112796 added the topic/gitea-actions related to the actions of Gitea label Jun 6, 2023
@kamzata
Copy link
Author

kamzata commented Jun 6, 2023

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
Copy link
Contributor

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
Copy link
Author

kamzata commented Jun 7, 2023

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
Copy link
Contributor

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
Copy link
Author

kamzata commented Jun 8, 2023

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?

lunny pushed a commit that referenced this issue Jun 11, 2023
Backport #25144 by @Zettat123

Fix #25093

If
[`WithPullRequest`](https://github.com/go-gitea/gitea/blob/679b1f7949aa40d4f962ef27f91b0b384b9c56a5/services/actions/notifier_helper.go#L90-L96)
is not called, the `Ref` in
[`notifyInput`](https://github.com/go-gitea/gitea/blob/679b1f7949aa40d4f962ef27f91b0b384b9c56a5/services/actions/notifier_helper.go#L55-L65)
will be empty, so the workflows in the head branch will not be found and
triggered.

Co-authored-by: Zettat123 <zettat123@gmail.com>
Codeberg-org pushed a commit to Codeberg-org/gitea that referenced this issue Jun 23, 2023
…a#25196)

Backport go-gitea#25144 by @Zettat123

Fix go-gitea#25093

If
[`WithPullRequest`](https://github.com/go-gitea/gitea/blob/679b1f7949aa40d4f962ef27f91b0b384b9c56a5/services/actions/notifier_helper.go#L90-L96)
is not called, the `Ref` in
[`notifyInput`](https://github.com/go-gitea/gitea/blob/679b1f7949aa40d4f962ef27f91b0b384b9c56a5/services/actions/notifier_helper.go#L55-L65)
will be empty, so the workflows in the head branch will not be found and
triggered.

Co-authored-by: Zettat123 <zettat123@gmail.com>
(cherry picked from commit de6ac4b)
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
topic/gitea-actions related to the actions of Gitea type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants