kdocs
GitHub
Lang - General
Lang - General
  • Code Versioning
    • Git
      • Configurations
      • Conventional Commit
      • Workflows
    • GitHub
      • Git Actions
    • GitOps
    • SemVer
  • Tests
    • Jest
Powered by GitBook
On this page
  • About
  • Main CI processes
  • Git Actions Components
  • Workflows
  • Events
  • Jobs
  • Actions
  1. Code Versioning
  2. GitHub

Git Actions

PreviousGitHubNextGitOps

Last updated 3 months ago

It is a workflow automator. It uses the main generated Github events to execute many different tasks, including CI/CD pipelines.

Main CI processes

  • Execute tests;

  • Linter the code;

  • Check code quality, reduce Code Smells, etc;

  • Security checks (like forgotten passwords or tokens on the code);

  • Generate artifacts for deploy (like zip files with executable, or docker images);

  • Identify the next Version to be generated (like SemVer);

  • Generate tags and releases. (like analyze Conventional Commit to auto generate Tags and Releases, based on the Commits history)

Git Actions Components

A repository can have multiple workflows, that triggers based on events on the repository, or manually triggered, or at a , or by .

Workflows contain one or more jobs that can run in sequencial order or in parallel.

Each Job will run inside its own virtual machine Runner or container and can have one or more Steps.

Each Step runs either a script or an action (reusable extensions).

Workflows

A workflow is a .yaml file that is created in the project's /.github/workflows folder.

You can reference a workflow within another workflow.

Inside workflows you can:

When including paths:

If a workflow is skipped due to path filtering, branch filtering, or a commit message, then checks associated with that workflow will remain in a "Pending" state.

A pull request that requires those checks to be successful will be blocked from merging.

Example

ci.yaml
name: angular-ci-workflow
on:
  pull_request:
    branches:
      - main
      - develop
jobs:
  test-angular:
    runs-on: ubuntu-latest
    steps:
      - run: echo "Starting Job"
      - run: echo "Trigger: (${{ github.event_name }}), Branch: (${{ github.ref }})"
      # Very common action to checkout your code to the container so it can use it
      - name: Checkout code
        uses: actions/checkout@v2
      # Will run an action specific for Angular, more details at its repository
      - name: Angular CI
        uses: colbyhill21/angular-full-ci/@v1.0
        with:
          testcommand: run test:ci
      - run: echo "Job finished with status ${{ job.status }}"

Events

Events are specific activities in a repository that triggers a workflow run.

Jobs

Are a set of steps that are executed on the same runner and can share data from one step to another.

Steps are executed in order and are dependent on each other.

You can configure dependencies between jobs.

By default, jobs have no dependency and run in parallel.

Runner

Each job execute in a separate Runner.

There are Linux, Windows and MacOS runners to run jobs.

Actions

Are custom application for GitHub Actions plataform that perfoms a complex but repeated task.

They are like Docker images, reusable base tasks that were done and shared by other.

You can also write your own actions.

Run ;

Filter execution ;

Use to access passwords;

Use ;

Use ;

Use ;

And

Read more .

Check .yaml file syntax .

Check a complete list of .

Check action in .

About
defined schedule
posting to a Rest API
scripts
over branches, file paths, or commit messages
GitHub secrets
variables
expressions
context variable
others...
here
here
events
GitHub Marketplace
Drawing