diff --git a/.github/steps/-step.txt b/.github/steps/-step.txt index 573541a..0cfbf08 100644 --- a/.github/steps/-step.txt +++ b/.github/steps/-step.txt @@ -1 +1 @@ -0 +2 diff --git a/.github/workflows/welcome.yml b/.github/workflows/welcome.yml new file mode 100644 index 0000000..f6f201b --- /dev/null +++ b/.github/workflows/welcome.yml @@ -0,0 +1,6 @@ +name: Post welcome comment +on: + pull_request: + types: [opened] + permissions: + pull-requests: write diff --git a/README.md b/README.md index f121210..7df0050 100644 --- a/README.md +++ b/README.md @@ -6,34 +6,44 @@ _Create and run a GitHub Actions workflow._ -## Welcome +## Step 2: Add a job to your workflow file -Automation is key for streamlining your work processes, and [GitHub Actions](https://docs.github.com/actions) is the best way to supercharge your workflow. +_Nice work! :tada: You added a workflow file!_ -- **Who is this for**: Developers, DevOps engineers, students, managers, teams, GitHub users. -- **What you'll learn**: How to create workflow files, trigger workflows, and find workflow logs. -- **What you'll build**: An Actions workflow that will check emoji shortcode references in Markdown files. -- **Prerequisites**: In this course you will work with issues and pull requests, as well as edit files. We recommend you take the [Introduction to GitHub](https://github.com/skills/introduction-to-github) course first. -- **How long**: This course can be finished in less than two hours. +Here's what the entries in the `welcome.yml` file, on the `welcome-workflow` branch, mean: -In this course, you will: +- `name: Post welcome comment` gives your workflow a name. This name will appear in the Actions tab of your repository. +- `on: pull_request: types: [opened]` indicates that your workflow will execute whenever someone opens a pull request in your repository. +- `permissions` assigns the workflow permissions to operate on the repository +- `pull-requests: write` gives the workflow permission to write to pull requests. This is needed to create the welcome comment. -1. Create a workflow -2. Add a job -3. Add a run step -4. Merge your pull request -5. See effect of the workflow +Next, we need to specify jobs to run. -### How to start this course +**What is a _job_?**: A job is a set of steps in a workflow that execute on the same runner (a runner is a server that runs your workflows when triggered). Workflows have jobs, and jobs have steps. Steps are executed in order and are dependent on each other. You'll add steps to your workflow later in the course. To read more about jobs, see "[Jobs](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions#jobs)". -[![start-course](https://user-images.githubusercontent.com/1221423/235727646-4a590299-ffe5-480d-8cd5-8194ea184546.svg)](https://github.com/new?template_owner=skills&template_name=hello-github-actions&owner=%40me&name=skills-hello-github-actions&description=My+clone+repository&visibility=public) +In the following activity, you'll add a "build" job to your workflow. You'll specify `ubuntu-latest` as the fastest, and cheapest, job runner available. If you want to read more about why we'll use that runner, see the code explanation for the line `runs-on: ubuntu-latest` in the "[Understanding the workflow file](https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions#understanding-the-workflow-file)" article. -1. Right-click **Start course** and open the link in a new tab. -2. In the new tab, most of the prompts will automatically fill in for you. - - For owner, choose your personal account or an organization to host the repository. - - We recommend creating a public repository, as private repositories will [use Actions minutes](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions). - - Scroll down and click the **Create repository** button at the bottom of the form. -3. After your new repository is created, wait about 20 seconds, then refresh the page. Follow the step-by-step instructions in the new repository's README. +### :keyboard: Activity: Add a job to your workflow file + +1. In a separate browser tab, make sure you are on the `welcome-workflow` branch and open your `.github/workflows/welcome.yml` file. +1. Edit the file and update its contents to: + + ```yaml copy + name: Post welcome comment + on: + pull_request: + types: [opened] + permissions: + pull-requests: write + jobs: + build: + name: Post welcome comment + runs-on: ubuntu-latest + ``` + +1. Click **Commit changes** in the top right of the workflow editor. +1. Type a commit message and commit your changes directly to the `welcome-workflow` branch. +1. Wait about 20 seconds, then refresh this page (the one you're following instructions from). Another workflow will run and will replace the contents of this README file with instructions for the next step.