Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
4204248b
Unverified
Commit
4204248b
authored
Jul 09, 2024
by
Derek Nola
Committed by
GitHub
Jul 09, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for bad token permissions when install via PR (#10387)
* Check for bad token permissions when install via PR Signed-off-by:
Derek Nola
<
derek.nola@suse.com
>
parent
8f9ad1f9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
install.sh
install.sh
+7
-3
install.sh.sha256sum
install.sh.sha256sum
+1
-1
No files found.
install.sh
View file @
4204248b
...
@@ -482,11 +482,15 @@ get_pr_artifact_url() {
...
@@ -482,11 +482,15 @@ get_pr_artifact_url() {
fi
fi
if
[
-z
"
${
GITHUB_TOKEN
}
"
]
;
then
if
[
-z
"
${
GITHUB_TOKEN
}
"
]
;
then
fatal
"Installing PR builds requires GITHUB_TOKEN with k3s-io/k3s repo
authorization
"
fatal
"Installing PR builds requires GITHUB_TOKEN with k3s-io/k3s repo
permissions
"
fi
fi
# GET request to the GitHub API to retrieve the latest commit SHA from the pull request
# GET request to the GitHub API to retrieve the latest commit SHA from the pull request
commit_id
=
$(
curl
-s
-H
"Authorization: Bearer
$GITHUB_TOKEN
"
"
$github_api_url
/pulls/
$INSTALL_K3S_PR
"
| jq
-r
'.head.sha'
)
pr_raw
=
$(
curl
-s
-H
"Authorization: Bearer
$GITHUB_TOKEN
"
"
$github_api_url
/pulls/
$INSTALL_K3S_PR
"
)
if
!
echo
"
$pr_raw
"
|
grep
-q
"Bad credentials.*401"
;
then
fatal
"Installing PR builds requires GITHUB_TOKEN with k3s-io/k3s repo permissions"
fi
commit_id
=
$(
echo
"
$pr_raw
"
| jq
-r
'.head.sha'
)
# GET request to the GitHub API to retrieve the Build workflow associated with the commit
# GET request to the GitHub API to retrieve the Build workflow associated with the commit
wf_raw
=
$(
curl
-s
-H
"Authorization: Bearer
$GITHUB_TOKEN
"
"
$github_api_url
/commits/
$commit_id
/check-runs"
)
wf_raw
=
$(
curl
-s
-H
"Authorization: Bearer
$GITHUB_TOKEN
"
"
$github_api_url
/commits/
$commit_id
/check-runs"
)
...
...
install.sh.sha256sum
View file @
4204248b
696c6a93262b3e1f06a78841b8a82c238a8f17755824c024baad652b18bc92bc
install.sh
2e2469498e1d6a5dcd97d0eeae342298500b27fe0768527ea8039a3295cdbce9
install.sh
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment