Skip to content

Commit

Permalink
Updates to match template (#310)
Browse files Browse the repository at this point in the history
* Updates to match template

* Add or update get current step jobs

* Update job conditional to include current step

* Clean up conditionals

* Update README.md

* Update README.md
  • Loading branch information
heiskr authored Feb 14, 2023
1 parent a750f5c commit a1542ab
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 13 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/0-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,29 @@ permissions:
contents: write

jobs:
get_current_step:
name: Check current step number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: get_step
run: |
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

on_start:
name: On start

# We will only run this action when:
# 1. This repository isn't the template repository
# 2. The STEP is currently 0
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
if: ${{ !github.event.repository.is_template }}
if: >-
${{ !github.event.repository.is_template
&& needs.get_current_step.outputs.current_step == 0 }}
# We'll run Ubuntu for performance instead of Mac or Windows
runs-on: ubuntu-latest
Expand Down
23 changes: 20 additions & 3 deletions .github/workflows/1-create-a-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,33 @@ permissions:
contents: write

jobs:
get_current_step:
name: Check current step number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: get_step
run: |
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

on_create_a_branch:
name: On create a branch

# We will only run this action when:
# 1. This repository isn't the template repository
# 2. The event is a branch
# 3. The branch name is `my-first-branch`
# 2. The STEP is currently 1
# 3. The event is a branch
# 4. The branch name is `my-first-branch`
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
if: ${{ !github.event.repository.is_template && github.ref_type == 'branch' && github.ref_name == 'my-first-branch' }}
if: >-
${{ !github.event.repository.is_template
&& needs.get_current_step.outputs.current_step == 1
&& github.ref_type == 'branch'
&& github.ref_name == 'my-first-branch' }}
# We'll run Ubuntu for performance instead of Mac or Windows
runs-on: ubuntu-latest
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/2-commit-a-file.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,29 @@ permissions:
contents: write

jobs:
get_current_step:
name: Check current step number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: get_step
run: |
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

on_commit_a_file:
name: On commit a file

# We will only run this action when:
# 1. This repository isn't the template repository
# 2. The STEP is currently 2
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
if: ${{ !github.event.repository.is_template }}
if: >-
${{ !github.event.repository.is_template
&& needs.get_current_step.outputs.current_step == 2 }}
# We'll run Ubuntu for performance instead of Mac or Windows
runs-on: ubuntu-latest
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/3-open-a-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,31 @@ permissions:
contents: write

jobs:
get_current_step:
name: Check current step number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: get_step
run: |
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

on_open_a_pull_request:
name: On open a pull request

# We will only run this action when:
# 1. This repository isn't the template repository
# 2. The head branch name is `my-first-branch`
# 2. The STEP is currently 3
# 3. The head branch name is `my-first-branch`
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
if: ${{ !github.event.repository.is_template && github.head_ref == 'my-first-branch' }}
if: >-
${{ !github.event.repository.is_template
&& needs.get_current_step.outputs.current_step == 3
&& github.head_ref == 'my-first-branch' }}
# We'll run Ubuntu for performance instead of Mac or Windows
runs-on: ubuntu-latest
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/4-merge-your-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,29 @@ permissions:
contents: write

jobs:
get_current_step:
name: Check current step number
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- id: get_step
run: |
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
outputs:
current_step: ${{ steps.get_step.outputs.current_step }}

on_merge_your_pull_request:
name: On merge your pull request

# We will only run this action when:
# 1. This repository isn't the template repository
# 2. The STEP is currently 4
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
if: ${{ !github.event.repository.is_template }}
if: >-
${{ !github.event.repository.is_template
&& needs.get_current_step.outputs.current_step == 4 }}
# We'll run Ubuntu for performance instead of Mac or Windows
runs-on: ubuntu-latest
Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ _Get started using GitHub in less than an hour._
Do not use quotes on the <details> tag attributes.
-->

<!--step0-->
<details id=0 open>
<summary><h2>Welcome</h2></summary>

People use GitHub to build some of the most advanced technologies in the world. Whether you’re visualizing data or building a new game, there’s a whole community and set of tools on GitHub that can help you do it even better. GitHub Skills’ “Introduction to GitHub” course guides you through everything you need to start contributing in less than an hour.

Expand All @@ -30,15 +31,15 @@ People use GitHub to build some of the most advanced technologies in the world.

## How to start this course

1. Above these instructions, right-click **Use this template** and open the link in a new tab.
![Use this template](https://user-images.githubusercontent.com/1221423/169618716-fb17528d-f332-4fc5-a11a-eaa23562665e.png)
1. Right-click **Start course** and open the link in a new tab.
<br />[![start-course](https://user-images.githubusercontent.com/1221423/218596841-0645fe1a-4aaf-4f51-9ab3-8aa2d3fdd487.svg)](https://github.com/skills/introduction-to-github/generate)
2. In the new tab, follow the prompts to create a new repository.
- For owner, choose your personal account or an organization to host the repository.
- We recommend creating a public repository—private repositories will [use Actions minutes](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions).
![Create a new repository](https://user-images.githubusercontent.com/1221423/169618722-406dc508-add4-4074-83f0-c7a7ad87f6f3.png)
![Create a new repository](https://user-images.githubusercontent.com/1221423/218594143-e60462b6-9f2a-4fa3-80de-063ac5429aab.png)
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.

<!--endstep0-->
</details>

<!--
<<< Author notes: Step 1 >>>
Expand Down

0 comments on commit a1542ab

Please sign in to comment.