Skip to content

Commit

Permalink
Merge pull request #92 from lumaxis/add-unarchive-a-repo
Browse files Browse the repository at this point in the history
Add script to unarchive a repo
  • Loading branch information
gm3dmo committed Mar 8, 2023
2 parents 468d31a + 146dcf0 commit 5773335
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions unarchive-a-repo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
. .gh-api-examples.conf

# https://docs.github.com/en/rest/repos/repos#update-a-repository
# PATCH /repos/{owner}/{repo}

json_file=tmp/update-a-repo.json
datestamp=$(date +%s)
description="unarchived by an archiving script at timestamp: ${datestamp}"

rm -f ${json_file}

jq -n \
--arg description "${description}" \
--arg archived "false" \
'{
description: $description,
archived: $archived
}' > ${json_file}

curl ${curl_custom_flags} \
-X PATCH \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
${GITHUB_API_BASE_URL}/repos/${org}/${repo} --data @${json_file}

rm -f ${json_file}

0 comments on commit 5773335

Please sign in to comment.