Skip to content

Commit

Permalink
Updates to match template (#35)
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

* Update README.md

* Update README.md
  • Loading branch information
heiskr committed Feb 14, 2023
1 parent dc34a38 commit 792309d
Show file tree
Hide file tree
Showing 7 changed files with 103 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 @@ -21,14 +21,29 @@ permissions:
pull-requests: 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
17 changes: 16 additions & 1 deletion .github/workflows/1-create-a-workflow.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_create_workflow:
name: On create workflow

# We will only run this action when:
# 1. This repository isn't the template repository
# 2. The STEP is currently 1
# 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 == 1 }}
# 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-add-a-job.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_add_job:
name: On add job

# 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
17 changes: 16 additions & 1 deletion .github/workflows/3-add-actions.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_add_actions:
name: On add actions

# We will only run this action when:
# 1. This repository isn't the template repository
# 2. The STEP is currently 3
# 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 == 3 }}
# 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:
name: On merge

# 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
18 changes: 16 additions & 2 deletions .github/workflows/5-trigger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,28 @@ 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_trigger:
name: On trigger

# We will only run this action when:
# 1. This repository isn't the template repository
# 2. The STEP is currently 5
# 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 == 5 }}
# We'll run Ubuntu for performance instead of Mac or Windows
runs-on: ubuntu-latest
Expand Down
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ _Create a GitHub Action and use it in a workflow._
Do not use quotes on the <details> tag attributes.
-->

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

Automation is key for streamlining your work processes, and [GitHub Actions](https://docs.github.com/actions) is the best way to supercharge your workflow.

Expand All @@ -30,15 +31,15 @@ Automation is key for streamlining your work processes, and [GitHub Actions](htt

## 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/hello-github-actions/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&mdash;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)
- We recommend creating a public repositoryprivate 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/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 792309d

Please sign in to comment.