liveBook · Manning

GitHub action

As explained in Automating API Delivery

A GitHub Actions action is a custom application that performs a reusable task within a GitHub Actions workflow.

A GitHub Actions action is a custom application that performs a reusable, repetitive task inside a workflow. Workflows respond to repository events, schedules, or manual triggers; jobs run on runners, and their steps execute sequentially. This lets an API team turn routine build and validation work into repeatable pipeline behavior. section 8.4

Use an action as one step in a configured workflow:

  • Place the workflow YAML file in .github/workflows. section 8.4
  • Trigger the workflow for events such as a pull request against main, or allow manual execution with workflow_dispatch. section 8.4
  • Assign the job to a runner such as ubuntu-latest, then combine actions with shell-script steps. section 8.4
  • Use actions/checkout@v3 to retrieve the pull-request branch and actions/setup-java@v3 to configure JDK 17 before compiling and testing. section 8.4
  • Treat the resulting checks as pipeline controls: a quality gate prevents proposals from progressing until required criteria pass. section 8.6

PR build action steps

A pull-request workflow can define a job on ubuntu-latest, check out the code, set up Temurin JDK 17 with Maven caching, and run mvn --batch-mode clean compile followed by mvn --batch-mode test. Passing checks provide fast feedback before API governance review; teams may also add controls such as API linting, breaking-change checks, or client-SDK generation. section 8.4 section 8.6

Listing 8.1 The PR build workflow
name: PR build workflow
on: 
  pull_request:
    branches: [main]      #1
  workflow_dispatch:            #2
jobs:
  pr-code-build:               #3
    name: Build and test source code
    runs-on: ubuntu-latest             #4
    steps:
      - name: Checkout out pr branch
        uses: actions/checkout@v3      #5
      - name: Set up JDK 17
        uses: actions/setup-java@v3
        with:
          java-version: '17'
          distribution: 'temurin'
          cache: maven
      - name: Compile
        run: |
          cd chapter8
          mvn --batch-mode clean compile      #6
      - name: Unit test
        run: |
          cd chapter8
          mvn --batch-mode test

Inspect the complete PR build workflow, including triggers, runner selection, reusable actions, Java configuration, compilation, and tests. section 8.4

How Automating API Delivery covers it

How deep it goes
Defines actions within sequential workflow steps and shows configuration, but does not describe action internals.
Examples
Uses checkout, Java setup, compilation, unit testing, API linting, and breaking-change checks in a pull-request workflow.
What it assumes
Assumes familiarity with repositories and YAML workflows while introducing runners, jobs, steps, triggers, and actions.
What you can do after
Operate/configure reusable workflow steps that automate repository builds and enforce selected API quality controls.
How it connects
Connects actions with workflows, events, jobs, steps, runners, CI/CD, and quality gates.

Also explained in

Compare how 3 books explain GitHub action →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Automating API Delivery. The section links point to the parts of the book it draws on.