Skip to content

Commit

Permalink
Fixed access github api failed (#8661)
Browse files Browse the repository at this point in the history
  • Loading branch information
ading007 authored Jun 15, 2021
1 parent 3143781 commit 2c978fe
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/resources/Github-Util.robot
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ Documentation This resource provides keywords to interact with Github
Get State Of Github Issue
[Arguments] ${num}
[Tags] secret
${headers_str} = Evaluate str("token %{GITHUB_AUTOMATION_API_KEY}")
&{headers} = Create Dictionary Authorization=${headers_str}
:FOR ${idx} IN RANGE 0 5
\ ${status} ${result}= Run Keyword And Ignore Error Get https://api.github.com/repos/vmware/vic/issues/${num} headers={"Authorization": "token %{GITHUB_AUTOMATION_API_KEY}"}
\ ${status} ${result}= Run Keyword And Ignore Error Get https://api.github.com/repos/vmware/vic/issues/${num} headers=${headers}
\ Exit For Loop If '${status}'
\ Sleep 1
Should Be Equal ${result.status_code} ${200}
Expand All @@ -30,17 +32,21 @@ Get State Of Github Issue
Post Comment To Github Issue
[Arguments] ${num} ${comment}
[Tags] secret
${headers_str} = Evaluate str("token %{GITHUB_AUTOMATION_API_KEY}")
&{headers} = Create Dictionary Authorization=${headers_str}
:FOR ${idx} IN RANGE 0 5
\ ${status} ${result}= Run Keyword And Ignore Error Post https://api.github.com/repos/vmware/vic/issues/${num}/comments data={"body": "${comment}"} headers={"Authorization": "token %{GITHUB_AUTOMATION_API_KEY}"}
\ ${status} ${result}= Run Keyword And Ignore Error Post https://api.github.com/repos/vmware/vic/issues/${num}/comments data={"body": "${comment}"} headers=${headers}
\ Exit For Loop If '${status}'
\ Sleep 1
Should Be Equal ${result.status_code} ${201}

Check VMware Organization Membership
[Arguments] ${username}
[Tags] secret
${headers_str} = Evaluate str("token %{GITHUB_AUTOMATION_API_KEY}")
&{headers} = Create Dictionary Authorization=${headers_str}
:FOR ${idx} IN RANGE 0 5
\ ${status} ${result}= Run Keyword And Ignore Error Get https://api.github.com/orgs/vmware/members/${username} headers={"Authorization": "token %{GITHUB_AUTOMATION_API_KEY}"}
\ ${status} ${result}= Run Keyword And Ignore Error Get https://api.github.com/orgs/vmware/members/${username} headers=${headers}
\ Exit For Loop If '${status}'
\ Sleep 1
${isMember}= Run Keyword And Return Status Should Be Equal ${result.status_code} ${204}
Expand Down

0 comments on commit 2c978fe

Please sign in to comment.