Task 03 - Cleanup GitHub artifacts
Introduction
As part of this training, you created GitHub secrets, variables, workflows, issues and pull requests that you may not want to retain in your organization or repository going forward. In particular, any secrets or variables could post a security concern if they were able to be misused. You can remove all of these artifacts to restore your organization and repository to a cleaner pre-lab state.
Description
In this task, you will remove GitHub secrets, variables, workflows, issues, pull requests, and other artifacts created during the lab exercises. This ensures your GitHub repository and organization are clean.
NOTE As you executed Copilot instructions during this lab, you may have different results for the names of credentials, variables and other artifacts. You will have to apply your actual names to the instructions below.
Success Criteria
- You have removed all GitHub secrets
- You have removed all GitHub variables
- You have cleaned up all workflow runs (optional)
- You have closed all lab-related issues
- You have closed or merged all pull requests
Learning Resources
Key Tasks
01: Remove GitHub Secrets
Remove all secrets that were created for the lab.
Expand this section for detailed steps
NOTE The secrets to remove are your service principal credentials such as:
AZURE_CREDENTIALS
From the command line
-
From Terminal in Visual Studio Code, run the following commands:
# Using GitHub CLI (recommended) gh secret delete AZURE_CREDENTIALS # If you have multiple secrets, list them first gh secret list # Delete each secret gh secret delete <secret-name>
From GitHub UI
-
Navigate to your repository in your GitHub organization.
-
Go to Settings → Secrets and variables → Actions.
-
Under Secrets, click on each secret.
-
Click Delete and confirm.
02: Remove GitHub Variables
Remove all variables that were created for the lab.
Expand this section for detailed steps
NOTE The variables to remove may be named similar to the following:
AZURE_CONTAINER_REGISTRY_NAMEAZURE_APP_SERVICE_NAMEAZURE_RESOURCE_GROUP(if created)AZURE_LOG_WORKSPACE_IDorLOG_WORKSPACE_ID
From the command line
-
From Terminal in Visual Studio Code, run the following commands:
# Using GitHub CLI gh variable list # Delete each variable gh variable delete AZURE_CONTAINER_REGISTRY_NAME gh variable delete AZURE_APP_SERVICE_NAME gh variable delete AZURE_RESOURCE_GROUP gh variable delete AZURE_LOG_WORKSPACE_ID gh variable delete LOG_WORKSPACE_ID
From GitHub UI
-
Navigate to your repository.
-
Go to Settings → Secrets and variables → Actions.
-
Under Variables, click on each variable.
-
Click Delete and confirm.
03: Clean Up GitHub Actions Workflows
Delete workflow files or disable them and keep them for reference.
Expand this section for detailed steps
Delete workflow files (recommended for cleanup)
-
From the Terminal window in Visual Studio Code, navigate to the root of your repository.
-
Run the following commands to delete workflow files:
# Delete workflow files git rm .github/workflows/*.yml git commit -m "Remove lab workflow files" git push
NOTE: The
.github/workflows/jekyll-gh-pages.ymlfile is for GitHub Pages and should be kept if you’re using GitHub Pages.
Keep workflow files but disable them
-
Open the YAML file and comment out the triggers:
# Comment out the triggers in your workflow file # on: # push: # branches: [ main ] # pull_request: # branches: [ main ]
04: Clean Up Workflow Runs (Optional)
Delete individual workflow runs from the command line or from GitHub UI.
Expand this section for detailed steps
NOTE: Workflow runs are automatically deleted after 90 days. Manual deletion is optional.
From the command line
-
List workflow runs:
gh run list -
Delete a specific workflow run:
gh run delete <run-id>
From GitHub UI
-
Navigate to your repository.
-
Go to Actions tab.
-
Click on a workflow run.
-
Click the … menu → Delete workflow run.
05: Close or Delete GitHub Issues
Close or delete issues created during the lab from the command line or from GitHub UI.
Expand this section for detailed steps
The issues to close or delete include:
- Infrastructure provisioning issue (Exercise 2)
- .NET upgrade issue (Exercise 5)
- Chat feature issue (Exercise 5)
- Any vulnerability tracking issues (Exercise 4)
From the command line
-
List all open issues:
gh issue list --state open -
Close an issue:
gh issue close <issue-number> -
Delete an issue (requires repository admin permissions):
gh issue delete <issue-number>
From GitHub UI
-
Navigate to your repository.
-
Go to Issues tab.
-
Open each issue.
-
Click Close issue or Delete (if you have permissions).
06: Close Pull Requests
Close any open pull requests created during the lab from the command line or from GitHub UI.
Expand this section for detailed steps
From the command line
-
List open pull requests:
gh pr list --state open -
Close a pull request:
gh pr close <pr-number> -
Delete a pull request (requires admin permissions):
gh pr delete <pr-number>
From GitHub UI
-
Navigate to your repository.
-
Go to Pull requests tab.
-
Open each PR.
-
Click Close pull request or Delete (if you have permissions).
07: Verification
Verify that all GitHub artifacts have been removed.
Expand this section for detailed steps
-
Run the following verification commands:
# Verify no secrets remain gh secret list # Verify no variables remain gh variable list # Verify no open issues remain gh issue list --state open # Verify no open PRs remain gh pr list --state open # List workflow files ls .github/workflows/
Summary
You’ve completed this task. You have removed all GitHub secrets, removed all GitHub variables, cleaned up workflow runs (optional), closed all lab-related issues, and closed or merged all pull requests.