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

  1. 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

  1. Navigate to your repository in your GitHub organization.

  2. Go to SettingsSecrets and variablesActions.

  3. Under Secrets, click on each secret.

  4. 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_NAME
  • AZURE_APP_SERVICE_NAME
  • AZURE_RESOURCE_GROUP (if created)
  • AZURE_LOG_WORKSPACE_ID or LOG_WORKSPACE_ID

From the command line

  1. 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

  1. Navigate to your repository.

  2. Go to SettingsSecrets and variablesActions.

  3. Under Variables, click on each variable.

  4. 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
  1. From the Terminal window in Visual Studio Code, navigate to the root of your repository.

  2. 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.yml file is for GitHub Pages and should be kept if you’re using GitHub Pages.

Keep workflow files but disable them

  1. 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

  1. List workflow runs:

     gh run list
    
  2. Delete a specific workflow run:

     gh run delete <run-id>
    

From GitHub UI

  1. Navigate to your repository.

  2. Go to Actions tab.

  3. Click on a workflow run.

  4. 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

  1. List all open issues:

     gh issue list --state open
    
  2. Close an issue:

     gh issue close <issue-number>
    
  3. Delete an issue (requires repository admin permissions):

     gh issue delete <issue-number>
    

From GitHub UI

  1. Navigate to your repository.

  2. Go to Issues tab.

  3. Open each issue.

  4. 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

  1. List open pull requests:

     gh pr list --state open
    
  2. Close a pull request:

     gh pr close <pr-number>
    
  3. Delete a pull request (requires admin permissions):

     gh pr delete <pr-number>
    

From GitHub UI

  1. Navigate to your repository.

  2. Go to Pull requests tab.

  3. Open each PR.

  4. 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
  1. 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.