From a461960fd456db1eda495160011a0bf14d89ee76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julien=20Fastr=C3=A9?= Date: Mon, 11 Mar 2024 11:48:05 +0100 Subject: [PATCH] Add debug behaviour --- README.md | 32 +++++++++++++++++++++++++++++++- main.go | 3 ++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a3bacff..72eeba1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,35 @@ # Gitea action to Create a Pull Request -Gitea action to create a pull request. +Gitea action to create a pull request. This action is not github action compatible. Inspired by https://github.com/peter-evans/create-pull-request, but without the ability to commit the changes. + +## Usage + +```yaml +name: Gitea Actions Demo +run-name: ${{ gitea.actor }} is testing out Gitea Actions +on: [push] + +jobs: + Explore-Gitea-Actions: + runs-on: ubuntu-latest + steps: + - name: Setup Go + uses: https://github.com/actions/setup-go@v5 + with: + go-version: '1.22' + + # ... do something with your code + + + + - name: Use Go Action + id: use-go-action + uses: https://gitea.champs-libres.be/julienfastre/action-create-pr@main + with: + assignees: julienfastre + base: master + labels: bug, invalid, something else + +``` diff --git a/main.go b/main.go index 5685df3..5452eaf 100644 --- a/main.go +++ b/main.go @@ -71,6 +71,7 @@ func main() { token := os.Getenv("GITHUB_TOKEN") fmt.Printf("Api url is %v\n", ctx.ServerURL) + fmt.Printf("Debug: GITHUB_TOKEN begins with %v (4 first characters)\n", token[0:4]) config, err := ParseActionConfig(*ctx) if err != nil { @@ -125,7 +126,7 @@ func (a *Agent) ExistingOpenPullRequest(config CreatePrConfig) (bool, *gitea.Pul gitea.ListPullRequestsOptions{State: gitea.StateOpen, ListOptions: gitea.ListOptions{Page: currentPage}}) if err != nil { - return false, nil, err + return false, nil, fmt.Errorf("error while listing all exisiting open pull requests: %v", err.Error()) } for _, pull := range pulls {