Skip to content

Commit 72a7107

Browse files
authored
App: Add workflow scope, auth: support env (#241)
* Add workflow to token scopes The github app token now requests also 'workflow' as it is necessary to open prs in the .github/workflows directory Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]> * Auth: Support env var natively Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]> --------- Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
1 parent af836b7 commit 72a7107

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

sourcetool/pkg/auth/authenticator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const (
3131
)
3232

3333
var oauthScopes = []string{
34-
"repo", "user:email",
34+
"repo", "user:email", "workflow",
3535
}
3636

3737
type Authenticator struct {

sourcetool/pkg/auth/implementation.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,9 @@ func (di *defaultImplementation) readToken() (string, error) {
176176

177177
data, err := os.ReadFile(filepath.Join(dir, configDirName, githubTokenFileName))
178178
if err != nil {
179+
// If the token file is not found, try reading it from the environment
179180
if errors.Is(err, os.ErrNotExist) {
180-
return "", nil
181+
return os.Getenv("GITHUB_TOKEN"), nil
181182
}
182183
return "", fmt.Errorf("reading token file: %w", err)
183184
}

0 commit comments

Comments
 (0)