Skip to content

GitHub 操作

一句话解释

GitHub 操作是 GitHub's 构建-in CI/CD platform 那个 automates workflows triggered 通过仓库事件.

用大白话说

GitHub 操作是 CI/CD service 构建 directly 到 GitHub. 你定义 workflows in YAML files 内部你的仓库 (in .github/workflows/ directory), and GitHub automatically runs them when certain events happen — like a push, a pull request, or a scheduled time.

A workflow consists of one or more jobs, and each job contains steps. Steps can run shell commands or use pre-built actions from the GitHub Marketplace (e.g., actions/checkout to clone your repo).

GitHub Actions is fully managed — no server to maintain. It provides free minutes for public repositories and a generous free tier for private ones. Runners can be GitHub-hosted (Ubuntu, Windows, macOS) or self-hosted.

示例

yaml
name: CI
on: [push, pull_request]
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - run: npm ci
      - run: npm test

这个 workflow 运行 on 每个推送 and 拉取请求: 检查 out code, 安装 dependencies, and 运行测试.

工作原理

  1. You create a YAML workflow file in .github/workflows/.
  2. GitHub detects the trigger event (push, PR, schedule, etc.).
  3. It spins up a runner and executes the job steps.
  4. Results appear in the Actions tab with logs and status badges.

常见混淆

  • 容易混淆的对象: Jenkins

    关键区别: GitHub 操作是 managed, 构建-in service 使用否 maintenance; Jenkins 是 self-hosted 服务器那个需要设置 and upkeep.

相关术语

解读错误信息

用大白话解释常见错误——什么意思、为什么发生、如何修复。

查看错误

← 返回术语表