Allow to add token from within the action.yml file.

This commit is contained in:
Julien Fastré 2024-03-11 12:07:12 +01:00
parent 9bd9f4bfb8
commit c555e77ad0
Signed by: julienfastre
GPG Key ID: BDE2190974723FCB
2 changed files with 6 additions and 2 deletions

View File

@ -4,6 +4,9 @@ runs:
using: 'go'
main: 'main.go'
inputs:
token:
description: 'Access token which allow to create pull requests'
default: ${{ github.token }}
title:
required: false
description: The title of the pull request
@ -23,6 +26,7 @@ inputs:
head:
description: >
The pull request head branch (the one within the new code is developed).
outputs:
pull-request-number:
description: 'The pull request number'

View File

@ -69,9 +69,9 @@ func main() {
githubactions.Fatalf("could not get context: %v", err.Error())
}
token := os.Getenv("GITHUB_TOKEN")
token := githubactions.GetInput("token")
fmt.Printf("Api url is %v\n", ctx.ServerURL)
fmt.Printf("Debug: GITHUB_TOKEN begins with %v (4 first characters) and length is %d\n", token[0:4], len(token))
fmt.Printf("Debug: token begins with %v (4 first characters) and length is %d\n", token[0:4], len(token))
config, err := ParseActionConfig(*ctx)
if err != nil {