Skip to content

Creating Pull Request via Rest Api (with Personal Token) Does Not Trigger Actions #33963

Open
@SupremeVoid

Description

@SupremeVoid

Description

Pull requests that get created via the rest api (with a personal access token from a user) do not trigger actions which listen to events like "pull_request" types: [ opened, closed ]

Example Action that creates a pull request via rest api.
Actions will not get executed for that automatically created pull request.

name: Create automatic pr
on:
    pull_request:
        types:
            - closed

jobs:
    create-pr:
        runs-on: act-latest
        steps:
            - name: Create automatic pull request
              env:
                  GITEA_URL: ${{ secrets.GIT_URL }}
                  BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
              run: |
                   REPO_OWNER_SLASH_NAME="${{ gitea.repository }}"
                   # here goes more action code
                   $(curl -s -X POST -H "Authorization: token $BOT_TOKEN" \
                      -H "Content-Type: application/json" \
                      -d "$PR_PAYLOAD" \
                      "$GITEA_URL/api/v1/repos/$REPO_OWNER_SLASH_NAME/pulls")

Gitea Version

1.23.3

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

Image

Git Version

2.39.5

Operating System

FreeBSD

How are you running Gitea?

We are hosting an instance of gitea via a FreeBSD binary on a machine.
I cannot provide the exact configuration. Except for networking, almost everything should be default/example like config.

Database

SQLite

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions