Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged

pprot #314

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions create-a-push-protection-bypass.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
. ./.gh-api-examples.conf

# https://docs.github.com/en/enterprise-cloud@latest/rest/secret-scanning/secret-scanning?apiVersion=2022-11-28#create-a-push-protection-bypass
# POST /repos/{owner}/{repo}/secret-scanning/push-protection-bypasses

# Use create-blob.sh to get a placeholder_id (for programmatic) or use the placeholder ids from the list when doing git push.

# If the script is passed an argument $1 use that as the name
if [ -z "$1" ]
then
placeholder_id="bob"
else
placeholder_id=$1
fi

reason="will_fix_later"


json_file=tmp/create-a-push-protection-bypass.json
jq -n \
--arg reason "${reason}" \
--arg placeholder_id "${placeholder_id}" \
'{
reason: $reason, placeholder_id: $placeholder_id
}' > ${json_file}


curl ${curl_custom_flags} \
-H "X-GitHub-Api-Version: ${github_api_version}" \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
"${GITHUB_API_BASE_URL}/repos/${owner}/${repo}/secret-scanning/push-protection-bypasses" --data @${json_file}