الفلاتر
طريقة البحث
  • الكلمات العادية تجد الأسماء والنصوص والأمثلة.
  • "كلمتان" تجد العبارة بالضبط.
  • --name أو -x تجد خيارًا.
  • #كلمة تبحث داخل الأوامر فقط.
  • @grep تجد الدروس والمعامل التي تستخدم grep.
  • الفلاتر: cat:network · in:labs · level:rhcsa · ch:8 · root:yes. ضع ! قبل كلمة لاستبعادها. OR بين الكلمات تعني إحداها.
  • ↑ ↓ للتنقل · Enter للفتح · Esc للإغلاق · / للبحث

الفصل 1الاسم في الدورة: Understanding GitHub Actions

Write your first workflow

GitHub Actions runs automation in your repository: a workflow (a YAML file in .github/workflows/) starts on an event, runs jobs on runners, and every job runs steps — shell commands or ready actions.

  • 5 الدروس
  • 3 الأوامر

هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.

$ مستخدم عادي# بصلاحية root (أو مع sudo)

1.1

Know the building blocks

Event → workflow → jobs → steps.

PartMeaning
WorkflowA YAML file in .github/workflows/
EventWhat starts it: push, pull request, schedule, manual
JobA group of steps on one runner; jobs run in parallel by default
StepOne shell command (run) or one action (uses)
RunnerThe machine: GitHub-hosted (ubuntu-latest, windows-latest, macos-latest) or self-hosted
ActionA reusable step from the Marketplace or your own repository

1.2

Write a workflow

The smallest useful workflow: on every push, check out the code and run a test.

.github/workflows/ci.yml
name: CI
on:
  push:
    branches: [main]
  pull_request:
 
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - name: Check out the code
        uses: actions/checkout@v4
      - name: Show the tools
        run: |
          uname -a
          python3 --version
      - name: Run the tests
        run: ./scripts/test.sh
mkdir -p .github/workflows
git add .github/workflows/ci.yml
git commit -m "Add CI workflow"
git push
gh run list
gh run watch
gh run view --log-failed

تذكّر

Indentation is part of YAML. Use spaces, never tabs. A wrong indent is the most common error.

1.3

Chain jobs

Jobs run in parallel. needs makes a job wait for others — build, then test, then deploy.

.github/workflows/pipeline.yml
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: make build
  test:
    needs: build
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: make test
  deploy:
    needs: [build, test]
    if: github.ref == 'refs/heads/main'
    runs-on: ubuntu-latest
    steps:
      - run: echo "deploy"

1.4

Choose a runner

GitHub-hosted runners are new, clean VMs for every job. Self-hosted runners are your own machines — for private networks or special hardware.

RunnerGoodWatch out
GitHub-hostedClean every time, no maintenanceMinutes limits on private repos
Self-hostedReach private networks, own tools, no minute costYou patch and secure them; never use them for public repos
Larger runnersMore CPU/RAM, static IPsCost

1.5

Read the results

Every run shows its jobs and the log of every step in the Actions tab, and as checks on the commit or pull request.

  • A red X on a pull request = a failed check; click Details for the log.
  • Re-run failed jobs after a flaky failure.
  • Add a badge to the README: ![CI](https://github.com/OWNER/REPO/actions/workflows/ci.yml/badge.svg).

كل الأوامر في هذا الفصل