Practice Lab: Using Git Issues and Actions

TRELLO, Slack and GITHUB are the Triad of Tools we use to deliver the Technology Project.


Understanding Project Management in IT and the Role of Git**

As you embark on your journey into the world of Information Technology (IT), it's important to understand the complexities and intricacies involved in delivering a successful IT project. Unlike many other fields, IT projects involve a myriad of moving parts, each with its own set of challenges and requirements.
Firstly, there are the client requirements. These are the needs and expectations of the client who has commissioned the project. These requirements can range from specific functionalities they want in the software to the overall user experience. Understanding and meeting these requirements is crucial to the success of the project.
Secondly, there are business concerns. These include budget constraints, timelines, resource allocation, and risk management. Balancing these concerns while still delivering a high-quality product is a delicate act that requires careful planning and management.
Thirdly, there are the technology developers - the people who will be doing the actual work of designing, coding, and testing the software. Coordinating their work, ensuring they have the resources they need, and keeping them on schedule is another critical aspect of project management.
All these elements must be coordinated and managed effectively to deliver the project plan on time and on budget. This is where project management comes in. Project management is the practice of initiating, planning, executing, controlling, and closing the work of a team to achieve specific goals and meet specific success criteria at the specified time.
One of the tools that can greatly assist in project management is Git, specifically Git Issues and Actions. Git Issues is a great tool for tracking all the technical requirements of a project. Each issue can represent a task, a bug, or a feature request, and can be assigned to specific team members, labeled for easy categorization, and tracked until completion.
Git Actions, on the other hand, is a tool for automating tasks. This can range from running tests every time code is pushed to the repository, to deploying the software to a production environment. By automating these tasks, you can ensure they are done consistently and efficiently, saving time and reducing the chance of human error.
In conclusion, project management is a critical skill in the IT industry. It is the glue that holds all the different parts of a project together and ensures that everything runs smoothly. As you progress in your studies, I encourage you to learn more about project management and the tools that can assist you in this task, such as Git Issues and Actions.
The objective of this lab is to familiarize you with the use of Git Issues and Actions.
By the end of this lab, you will be able to create and manage issues, and automate tasks using GitHub Actions.
Prerequisites: A GitHub account and a basic understanding of Git and GitHub.

Lab Instructions:

Create a New Repository:Log in to your GitHub account.
Click on the '+' icon on the top right corner and select 'New repository'.
Name the repository 'git-lab' and initialize it with a README file.
Create an Issue: Go to the 'Issues' tab in your new repository and click on 'New Issue'.
Give it a title (e.g., "Add project description") and a brief description. Click on 'Submit new issue'.
Manage the Issue: Go back to the 'Issues' tab.
You will see the issue you just created.
Click on it, add a comment if needed, and close the issue once it's resolved (i.e., after you add the project description to the README file).
Create a GitHub Action: Go to the 'Actions' tab in your repository and click on 'New workflow'. We create an Action by Clicking on “NEW WORKFLOW” ​ You can set up a workflow yourself or choose a template. For this lab, let's choose the 'Simple workflow' template.
Configure the Action: In the 'Edit new file' tab, you will see a YAML (yet another markup language) file that defines the steps of the workflow. ​This file is divided into three sections: name, on, and jobs.

# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the workflow will run
# Triggers the workflow on push or pull request events but only for the "main" branch
branches: [ "main" ]
branches: [ "main" ]

# Allows you to run this workflow manually from the Actions tab

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
# This workflow contains a single job called "build"
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4

# Runs a single command using the runners shell
- name: Run a one-line script
run: echo Hello, world!

# Runs a set of commands using the runners shell
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.

The name is the name of your workflow. The on section defines when your workflow will run (e.g., on every push and pull_request). The jobs section defines the steps that your workflow will do. For this lab, let's keep it simple.
Your workflow will just print a "Hello, World!" message.
Replace the steps section with the following:
- name: Print a message
run: echo "Hello, World!"

Commit the Action: Click on 'Start commit', add a commit message, and click on 'Commit new file'.
Observe the Action: Go back to the 'Actions' tab. You will see your workflow listed there.
Click on it and then click on the specific run on the left. You will see the "Hello, World!" message printed in the 'Print a message' step.

Beneficial Outcome: By completing this lab, you will have hands-on experience with Git Issues and Actions. You will understand how to create and manage issues, which is a crucial aspect of project management. You will also understand how to automate tasks using GitHub Actions, which can save you a lot of time and effort in real-world projects.


### Git Actions and Git Version Control Automation in Software Development

#### Introduction to Git Actions
**What are Git Actions?** - **Definition:** GitHub Actions is a CI/CD platform that allows you to automate your software development workflows directly in your GitHub repository. You can write individual tasks, called actions, and combine them to create custom workflows. - **Importance:** Automates repetitive tasks, ensuring consistency and efficiency in the development process. It helps in building, testing, and deploying code automatically based on specific triggers.
**Benefits of Using Git Actions in Software Development:** 1. **Automation:** Reduces manual intervention by automating tasks such as testing, building, and deploying code. 2. **Integration:** Seamlessly integrates with GitHub, leveraging the full power of the GitHub ecosystem. 3. **Consistency:** Ensures that all developers follow the same processes, leading to more consistent and reliable code. 4. **Efficiency:** Saves time by automating repetitive tasks, allowing developers to focus on more critical work. 5. **Customization:** Offers flexibility to create custom workflows tailored to specific project needs.
#### Setting up Git Actions
**Step-by-Step Guide:**
1. **Set Up a GitHub Repository:** - **Create a Repository:** - Go to [GitHub]( - Click on the "+" icon in the top right corner and select "New repository." - Enter the repository name and description. - Choose the repository type (public or private). - Check "Initialize this repository with a README." - Click "Create repository."
2. **Create a Basic Workflow File for Git Actions:** - **Navigate to the Actions Tab:** - In your repository, click on the "Actions" tab. - Click on "New workflow." - Choose a starter workflow or set up a workflow yourself.
- **Create a Workflow File:** - Name your workflow file (e.g., `main.yml`). - Add the following basic YAML configuration: ```yaml name: CI
on: [push]
jobs: build: runs-on: ubuntu-latest
steps: - uses: actions/checkout@v2 - name: Run a one-line script run: echo Hello, world! ```
#### Creating Workflows
**Defining Workflows Using YAML Syntax:**
1. **Triggers:** - Specify events that trigger the workflow, such as `push`, `pull_request`, `schedule`, etc. ```yaml on: [push, pull_request] ```
2. **Jobs:** - Define jobs that run in the workflow. Each job runs in a fresh virtual environment. ```yaml jobs: build: runs-on: ubuntu-latest ```
3. **Steps:** - Define steps within each job. Each step can run commands or actions. ```yaml steps: - uses: actions/checkout@v2 - name: Set up Node.js uses: actions/setup-node@v2 with: node-version: '14' - run: npm install - run: npm test ```
#### Advanced Workflows
**Creating Complex Workflows:**
1. **Multiple Jobs and Parallel Execution:** - Define multiple jobs that can run in parallel or sequentially. ```yaml jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Build run: echo Build step
test: runs-on: ubuntu-latest needs: build steps: - uses: actions/checkout@v2 - name: Test run: echo Test step ```
2. **Using Actions from GitHub Marketplace:** - Integrate pre-built actions from the GitHub Marketplace to extend functionality. ```yaml steps: - uses: actions/checkout@v2 - name: Setup Python uses: actions/setup-python@v2 with: python-version: '3.8' - run: pip install -r requirements.txt - run: pytest ```
#### Troubleshooting and Best Practices
**Debugging Workflows and Common Errors:** - **Check Logs:** Use the logs provided by GitHub Actions to identify issues. - **Use `continue-on-error`:** Allow a step to fail without failing the entire job. ```yaml - run: some-command continue-on-error: true ```
**Best Practices:** 1. **Modular Workflows:** Break down workflows into reusable components. 2. **Secrets Management:** Use GitHub Secrets to manage sensitive information. 3. **Efficient Caching:** Use caching to speed up workflow execution. ```yaml - name: Cache NPM dependencies uses: actions/cache@v2 with: path: ~/.npm key: ${{ runner.os }}-npm-cache restore-keys: | ${{ runner.os }}-npm-cache ```
#### Conclusion
**Key Takeaways:** - **Understanding Git Actions:** Git Actions are a powerful tool for automating software development workflows. - **Setting Up and Using Workflows:** You learned how to set up a basic workflow and define more complex workflows using YAML syntax. - **Advanced Workflows and Best Practices:** You explored advanced workflow configurations and learned best practices for creating efficient and maintainable workflows.
Encourage students to continue exploring Git Actions and automation in their projects. Automation not only increases productivity but also ensures consistency and reliability in software development processes.
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
) instead.