GitHub Actions: Using GitHub Script

This course covers how to use GitHub Script to quickly use octokit/rest in a GitHub Actions workflow.

Start free course Join 611 others!

social preview

GitHub Script is a special action that allows using octokit/rest.js directly in a workflow file.

Over the duration of this course you will learn the skills needed to begin using the GitHub Script action to interact with your repository which will save you from creating full blown actions that carry unnecessary overhead.

What you'll learn

In this course you will learn how to:

  • Use GitHub Script in your workflow
  • Comment on issues using octokit
  • Add issues to a project board using octokit
  • Use the workflow expression syntax to filter when jobs run in a workflow.

What you'll build

A user opens an issue, the GitHub Actions bot responds with a welcome message. Another window shows that the issue has been added to a project board.

In this course you will automatically generate a comment on every new issue using a templated response. Additionally, if this issue is labeled as a bug it will be automatically added to the "needs triage" column of a project board.

Prerequisites

We first recommend taking the following courses:

Projects used

This makes use of the following open source projects. Consider exploring these repos and maybe even making contributions!

  • GitHub Script, a unique action that provides an authenticated octokit client and allows JavaScript to be written directly in a workflow file.

Audience

Developers, DevOps Engineers, students, teams

Steps to complete this course 11
  1. Start here!

    Create a pull request to add a workflow

  2. Merge your first pull request

    Make the workflow available to the repository by merging the pull request

  3. Add another GitHub Script action

    Use GitHub Script to place this issue into a project board

  4. Modify your workflow file

    Create a pull request to add changes to your workflow

  5. Merge the updated workflow into the master branch

    Make the workflow available for use on the repository

  6. Break your workflow into multiple steps

    Separate the workflow concerns by adding more steps

  7. Create better comments

    Use a templated repsonse as the comment body

  8. Use a templated response

    Create the comment body from a template using the Node.js file system module

  9. Merge the updated workflow

    Merge the worklow to the master branch

  10. Another workflow run

    Observe the results of an enhanced workflow run

  11. Course recap

    Final notes on course

Tags
GitHub Actions
Octokit
Workflow
Automation
Application programming interface (API)
Share this course
Average time to complete

23 minutes

Free

All public courses on Learning Lab are free.

Latest release

Learning Paths that include this course

Users who took this course also took

What is GitHub Learning Lab?

Learn new skills by completing fun, realistic projects in your very own GitHub repository.