From b6774dc8420852b07d6e39a39047dbd4e463a61d Mon Sep 17 00:00:00 2001 From: Shane C Date: Fri, 6 Sep 2024 21:32:20 -0400 Subject: [PATCH] use inputs to get token --- action.yml | 14 ++++++++++++++ cmd/root.go | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index f106dcb..ad71b9c 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,19 @@ name: 'GoSec Scanning' description: 'Scan codebase with gosec' +inputs: + token: + description: > + Personal access token (PAT) used to fetch the repository. The PAT is configured + with the local git config, which enables your scripts to run authenticated git + commands. The post-job step removes the PAT. + + + We recommend using a service account with the least permissions necessary. + Also when generating a new PAT, select the least scopes necessary. + + + [Learn more about creating and using encrypted secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets) + default: ${{ github.token }} runs: using: 'docker' image: 'docker://git.shadowhosting.xyz/actions/goscan:latest' \ No newline at end of file diff --git a/cmd/root.go b/cmd/root.go index fad917b..7721da8 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -185,7 +185,7 @@ var rootCmd = &cobra.Command{ log.Fatalln(err) } - forgeClient, err := forgejo.NewClient(actionCtx.ServerURL, forgejo.SetToken(os.Getenv("GITHUB_TOKEN"))) + forgeClient, err := forgejo.NewClient(actionCtx.ServerURL, forgejo.SetToken(action.GetInput("token"))) if err != nil { log.Fatalln(err) }