Hello GitHub Actions

Create and run a GitHub Actions workflow.

Step 1: Create a workflow file

Welcome to "Hello GitHub Actions"! 👋

What is GitHub Actions?: GitHub Actions is a flexible way to automate nearly every aspect of your team's software workflow. You can automate testing, continuously deploy, review code, manage issues and pull requests, and much more. The best part, these workflows are stored as code in your repository and easily shared and reused across teams. To learn more, check out these resources:

What is a workflow?: A workflow is a configurable automated process that will run one or more jobs. Workflows are defined in special files in the .github/workflows directory and they execute based on your chosen event. For this exercise, we'll use a pull_request event.

To get you started, we ran an Actions workflow in your new repository that, among other things, created a branch for you to work in, called welcome-workflow.

⌨️ Activity: Create a workflow file

  1. Open a new browser tab, and navigate to this same repository. Then, work on the steps in your second tab while you read the instructions in this tab.

  2. Create a pull request. This will contain all of the changes you'll make throughout this part of the course.

    Click the Pull Requests tab, click New pull request, set base: main and compare:welcome-workflow, click Create pull request, then click Create pull request again.

  3. Navigate to the Code tab.

  4. From the main branch dropdown, click on the welcome-workflow branch.

  5. Navigate to the .github/workflows/ folder, then select Add file and click on Create new file.

  6. In the Name your file field, enter welcome.yml.

  7. Add the following content to the welcome.yml file:

    name: Post welcome comment
    on:
      pull_request:
        types: [opened]
    permissions:
      pull-requests: write
  8. To commit your changes, click Commit changes.

  9. Type a commit message, select Commit directly to the welcome-workflow branch and click Commit changes.

  10. Wait about 20 seconds, then refresh this page (the one you're following instructions from). A separate Actions workflow in the repository (not the workflow you created) will run and will automatically replace the contents of this README file with instructions for the next step.


Get help: Post in our discussion boardReview the GitHub status page

© 2023 GitHub • Code of ConductMIT License