Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

Commit

Permalink
get authenticated user info
Browse files Browse the repository at this point in the history
  • Loading branch information
rajatjindal committed Oct 5, 2019
1 parent eb04c31 commit 1af5f6c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v1
- name: Open PR for new release of Krew Plugin
uses: rajatjindal/[email protected].27
uses: rajatjindal/[email protected].28
with:
plugin-name: 'your-plugin-name'
upstream-krew-index-owner: 'kubernetes-sigs'
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ inputs:
required: false
runs:
using: 'docker'
image: 'docker://rajatjindal/krew-plugin-release:v0.0.27'
image: 'docker://rajatjindal/krew-plugin-release:v0.0.28'
args:
- ${{ inputs.upstream-krew-index-owner }}
- ${{ inputs.upstream-krew-index-repo-name }}
Expand Down
6 changes: 3 additions & 3 deletions pkg/actions/actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (r RealAction) GetActionData() (ActionData, error) {
}

token := os.Getenv("KREW_PLUGIN_RELEASE_TOKEN")
tokenUserEmail, tokenUserName, err := r.getUserInfo(tokenUserHandle, token)
tokenUserEmail, tokenUserName, err := r.getUserInfo(token)
if err != nil {
return ActionData{}, err
}
Expand Down Expand Up @@ -122,12 +122,12 @@ func (r RealAction) getPayload() ([]byte, error) {
return data, nil
}

func (r RealAction) getUserInfo(username, token string) (string, string, error) {
func (r RealAction) getUserInfo(token string) (string, string, error) {
ts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token})
tc := oauth2.NewClient(context.TODO(), ts)
client := github.NewClient(tc)

user, _, err := client.Users.Get(context.TODO(), username)
user, _, err := client.Users.Get(context.TODO(), "")
if err != nil {
return "", "", err
}
Expand Down

0 comments on commit 1af5f6c

Please sign in to comment.