Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 2.2 KB

File metadata and controls

46 lines (33 loc) · 2.2 KB

Step 3: Add a step to your workflow file

Nice work adding a job to your workflow! 💃

📖 Theory: Introduction to steps in jobs

Steps are the building blocks of jobs, allowing you to automate tasks like checking out code, running commands, or using open source Actions. They run sequentially in the job's environment but as independent processes. Unlike traditional code with a shared variable space, inputs and outputs must be explicitly declared.

Tip

The best part of GitHub Actions is the marketplace where the community has already built many free useful tools to find and customize!

⌨️ Activity: Add a step to your workflow file

  1. In the welcome-workflow branch, open your .github/workflows/welcome.yml file.

  2. Add a step to the welcome job to post a comment on new pull requests using GitHub CLI:

    name: Post welcome comment
    on:
      pull_request:
        types: [opened]
    permissions:
      pull-requests: write
    jobs:
      welcome:
        name: Post welcome comment
        runs-on: ubuntu-latest
        steps:
          - run: gh pr comment "$PR_URL" --body "Welcome to the repository!"
            env:
              GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
              PR_URL: ${{ github.event.pull_request.html_url }}
  3. Commit your changes directly to welcome-workflow branch.

  4. With the step information added, Mona will review your work and prepare the next step in this exercise!

Having trouble? 🤷
  • Make sure the steps section is under the welcome job and properly indented.
  • Ensure you have the correct environment variables set.