一键导入
publish-exercise
// Publish a GitHub Skills exercise repository safely to GitHub. Use when asked to create the remote repository, prepare repository settings, and publish an exercise after review is complete.
// Publish a GitHub Skills exercise repository safely to GitHub. Use when asked to create the remote repository, prepare repository settings, and publish an exercise after review is complete.
Bootstrap a GitHub Skills exercise repository from an approved outline. Use when asked to turn an outline into a working exercise with README, step content, workflows, and review content.
Create or refine a GitHub Skills exercise outline. Use when asked to plan a new exercise, draft an outline, turn notes into an outline, or improve an existing outline before implementation.
Review a GitHub Skills exercise for format, clarity, learner flow, and workflow correctness. Use when asked to review an exercise draft, inspect step content, or find issues before publishing.
| name | publish-exercise |
| description | Publish a GitHub Skills exercise repository safely to GitHub. Use when asked to create the remote repository, prepare repository settings, and publish an exercise after review is complete. |
Check the exercise repository for a remote. If it already has one, do nothing.
/workspaces/repos/** folder.Try to determine the current user's GitHub account username.
gh auth status
echo $GITHUB_OWNER
Ask the user if they would like to publish the current exercise repository to that location.
If they reject, do nothing and exit.
If they confirm, create an empty repository in their account with the same name as the current exercise repository. Add the remote but do not publish the exercise repository yet!
gh repo create {owner}/{exercise-name} --private
gh api -X PUT repos/{owner}/{exercise-name}/actions/permissions -F enabled=false | cat
Before publishing, adjust the following repository settings:
Set the repository as template.
gh api -X PATCH /repos/{owner}/{exercise-name} -F is_template=true | cat
gh api -X PATCH /repos/{owner}/{exercise-name} -f description="{description}" | cat
Publish the exercise repository to the user's account.
git push -u origin main
After publishing, disable current workflows and reenable Actions.
Check the exercise repository for workflows. Disable all workflows that are found.
gh api -X GET /repos/{owner}/{exercise-name}/actions/workflows | cat
gh api -X PUT /repos/{owner}/{exercise-name}/actions/workflows/{workflow_id}/disable | cat
gh api -X PUT repos/{owner}/{exercise-name}/actions/permissions -F enabled=true | cat
template_owner in the "Copy Exercise" button's URL from skills to the new repository owner. Commit and push the change.