Skip to content

Commit 99d4391

Browse files
committed
complited git-github docs
1 parent 14ecc9c commit 99d4391

File tree

5 files changed

+406
-1
lines changed

5 files changed

+406
-1
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"label": "GitHub More Topics",
3+
"position": 7,
4+
"link": {
5+
"type": "generated-index",
6+
"title": "GitHub More Topics for Absolute Beginners",
7+
"description": "Explore more GitHub topics for absolute beginners, including advanced features, best practices, and tips to enhance your GitHub experience. Learn about branching, pull requests, GitHub Actions, and more to take your GitHub skills to the next level."
8+
}
9+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
title: "Introduction to GitHub Actions"
3+
sidebar_label: "1. GitHub Actions"
4+
sidebar_position: 1
5+
description: "Learn how to automate your software development workflows directly in your GitHub repository. From running tests to deploying your website, GitHub Actions has you covered."
6+
tags: ["github", "automation", "ci/cd", "devops", "workflow"]
7+
keywords: ["github actions", "automation", "ci/cd", "devops", "workflow", "yml", "events", "jobs", "actions"]
8+
---
9+
10+
In a professional workflow, we don't want to manually run tests or deploy our website every time we make a change. We want a system that does it for us.
11+
12+
**GitHub Actions** is an automation platform that allows you to create custom software development life cycle (SDLC) workflows directly in your GitHub repository.
13+
14+
:::info What is GitHub Actions?
15+
GitHub Actions is a powerful tool that lets you automate tasks like testing, building, and deploying your code whenever certain events happen in your repository. It's like having a robot assistant that takes care of the repetitive tasks for you.
16+
:::
17+
18+
## How it Works: The "Robot Assistant"
19+
20+
Think of GitHub Actions as a **Robot Assistant** that follows a simple rule:
21+
> **"When [This Event] happens, do [This Job]."**
22+
23+
* **The Event:** Someone pushes code, opens a Pull Request, or even stars your repo.
24+
* **The Job:** Run security scans, check for code errors, or deploy the site to a server.
25+
26+
## The Core Concepts
27+
28+
To master Actions at **CodeHarborHub**, you need to understand these four terms:
29+
30+
1. **Workflows:** The automated process (stored in a `.yml` file).
31+
2. **Events:** The "Trigger" that starts the workflow (e.g., `push`).
32+
3. **Jobs:** A set of steps that execute on the same runner (a virtual computer).
33+
4. **Actions:** Reusable building blocks (like a "Login to AWS" block or "Install Node.js" block).
34+
35+
## Creating Your First Workflow
36+
37+
GitHub Actions are defined in **YAML** files. You must place them in a specific folder in your project: `.github/workflows/`.
38+
39+
```yaml title=".github/workflows/welcome.yml"
40+
name: CodeHarborHub Welcome
41+
on: [push] # The Trigger
42+
43+
jobs:
44+
greet-developer:
45+
runs-on: ubuntu-latest # The Virtual Machine
46+
steps:
47+
- name: Say Hello
48+
run: echo "Automation is running successfully for CodeHarborHub!"
49+
```
50+
51+
## The CI/CD Pipeline
52+
53+
GitHub Actions is most commonly used for **CI/CD**:
54+
55+
* **Continuous Integration (CI):** Automatically building and testing code so that errors are caught immediately when a developer pushes a branch.
56+
* **Continuous Deployment (CD):** Automatically "Pushing" the code to a live server (like Vercel, Netlify, or AWS) after the tests pass.
57+
58+
## Why use Actions at CodeHarborHub?
59+
60+
| Benefit | Description |
61+
| :--- | :--- |
62+
| **No More "Works on my machine"** | Tests run on a clean cloud computer every time. |
63+
| **Speed** | Robots work 24/7. Your site deploys the second you merge a PR. |
64+
| **Security** | Automatically scan your code for leaked passwords or vulnerable packages. |
65+
| **Free for Open Source** | GitHub provides free minutes for public repositories\! |
66+
67+
## Monitoring Your Actions
68+
69+
Once you push a workflow file, you can watch it run in real-time:
70+
71+
1. Go to your repository on GitHub.
72+
2. Click the **Actions** tab.
73+
3. Click on a specific "Workflow Run" to see the logs and status.
74+
75+
:::tip
76+
Don't reinvent the wheel! Visit the [GitHub Marketplace](https://github.com/marketplace#type#Dactions) to find thousands of pre-written Actions created by the community that you can drop into your own projects.
77+
:::
Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
title: "Installing and Using GitHub CLI"
3+
sidebar_label: "2. GitHub CLI (gh)"
4+
sidebar_position: 2
5+
description: "Learn how to install and use the GitHub CLI (gh) to manage your repositories, issues, and pull requests directly from the command line. This guide covers installation steps for Windows, macOS, and Linux, as well as essential commands to streamline your workflow."
6+
tags: ["GitHub CLI", "gh", "Command Line", "GitHub Tools", "Developer Workflow"]
7+
keywords: ["GitHub CLI", "gh", "Command Line Interface", "GitHub Tools", "Developer Workflow"]
8+
---
9+
10+
While the GitHub website is beautiful and easy to use, professional developers often find it faster to perform tasks directly from the command line. The **GitHub CLI (`gh`)** is the official tool that brings GitHub’s issues, pull requests, and other features to your terminal.
11+
12+
At **CodeHarborHub**, we use `gh` to streamline our workflow and keep our focus on the code.
13+
14+
:::tip
15+
Don't worry if you're new to the command line! The GitHub CLI is designed to be user-friendly, and this guide will help you get started step by step. By the end, you'll be able to manage your GitHub projects without ever leaving your terminal.
16+
:::
17+
18+
## Why use the CLI?
19+
20+
1. **Context Switching:** You don't have to leave VS Code or your terminal to open a Pull Request.
21+
2. **Automation:** You can write scripts to create repositories or check status automatically.
22+
3. **Speed:** Most common actions (like cloning a repo or checking a PR) are 3x faster with a single command.
23+
24+
## Installation
25+
26+
<Tabs>
27+
<TabItem value="windows" label="Windows" default>
28+
29+
Open PowerShell or Command Prompt and run:
30+
31+
```bash
32+
winget install --id GitHub.cli
33+
```
34+
35+
</TabItem>
36+
<TabItem value="mac" label="macOS">
37+
38+
Use Homebrew:
39+
40+
```bash
41+
brew install gh
42+
```
43+
44+
</TabItem>
45+
<TabItem value="linux" label="Linux">
46+
47+
For Debian/Ubuntu:
48+
49+
```bash
50+
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
51+
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
52+
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
53+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
54+
sudo apt update
55+
sudo apt install gh -y
56+
```
57+
58+
</TabItem>
59+
</Tabs>
60+
61+
## Getting Started: Authentication
62+
63+
Once installed, you need to link the CLI to your GitHub account. Run:
64+
65+
```bash
66+
gh auth login
67+
```
68+
69+
Follow the interactive prompts:
70+
71+
* Select **GitHub.com** (unless you're using GitHub Enterprise).
72+
* Choose **HTTPS** or **SSH**.
73+
* Select **Login with a web browser** (this will open a page to authorize the app).
74+
75+
## Essential Commands for Daily Work
76+
77+
| Task | Command | Description |
78+
| :--- | :--- | :--- |
79+
| **Repo Status** | `gh repo view` | Shows the README and basic info for the current repo. |
80+
| **List PRs** | `gh pr list` | Lists all open Pull Requests in the repository. |
81+
| **Check out PR** | `gh pr checkout <number>` | Downloads a teammate's PR to your PC to test it. |
82+
| **Create PR** | `gh pr create` | Opens a new Pull Request for your current branch. |
83+
| **View Issues** | `gh issue list` | Shows all open bugs or tasks. |
84+
85+
## Common Workflow Example
86+
87+
Imagine you want to start a new project for **CodeHarborHub**. Instead of clicking through the website:
88+
89+
1. **Create a new repo:**
90+
```bash
91+
gh repo create my-new-project --public --clone
92+
```
93+
2. **Change into the folder:**
94+
```bash
95+
cd my-new-project
96+
```
97+
3. **Open in VS Code:**
98+
```bash
99+
code .
100+
```
101+
102+
*You just set up a full project in 5 seconds!*
103+
104+
## The "Status" View
105+
106+
One of the best features of `gh` is the **Dashboard** view. Run this to see everything happening with your work:
107+
108+
```bash
109+
gh status
110+
```
111+
112+
It shows your relevant Pull Requests, their review status, and if your **GitHub Actions** tests passed or failed.
113+
114+
:::tip
115+
You can use the `--web` flag with almost any command (e.g., `gh pr view --web`) to instantly open that specific page in your browser if you need to see the full UI.
116+
:::

absolute-beginners/git-github-beginner/more-github/index.mdx

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)