Skip to content

Commit b363e6c

Browse files
authored
Reset STEP to 0 and fix YAML files (#8)
* Revert "Update to 1 in STEP and README.md" This reverts commit 51da327. * Fix workflows Use multi-line conditional expressions !github.event.repository.is_template Use skills/action-update-step@v1 * Delete 'close' in <details id=1> * Use X for the last step Finish Edit YAML comments * Use emoji shortcodes :x: * Revert "Update my-workflow.yml" This reverts commit 15ec6c7. * Fix my-workflow.yml Fix the indent style and add a conditional expression
1 parent e5b5514 commit b363e6c

10 files changed

+106
-99
lines changed

‎.github/script/STEP

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1
1+
0

‎.github/workflows/0-start.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ jobs:
3636

3737
# We will only run this action when:
3838
# 1. This repository isn't the template repository
39-
# 2. The STEP is currently '0' (see update-step.sh)
39+
# 2. The STEP is currently 0
4040
# 3. This is the first workflow run on the repository
4141
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
4242
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
43-
if: ${{ !github.event.repository.is_template }}
43+
if: >-
44+
${{ !github.event.repository.is_template
45+
&& needs.get_current_step.outputs.current_step == 0 }}
4446
4547
# We'll run Ubuntu for performance instead of Mac or Windows
4648
runs-on: ubuntu-latest
@@ -89,8 +91,8 @@ jobs:
8991
# and open <details id=1>
9092
# and set STEP to '1'
9193
- name: Update to step 1
92-
run: ./.github/script/update-step.sh
93-
env:
94-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95-
FROM_STEP: 0
96-
TO_STEP: 1
94+
uses: skills/action-update-step@v1
95+
with:
96+
token: ${{ secrets.GITHUB_TOKEN }}
97+
from_step: 0
98+
to_step: 1

‎.github/workflows/1-initialize-javascript-project.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Step 1, Initialize JavaScript Project
22

3-
# This step triggers after 0-start.yml
3+
# This step listens for the learner pushing a commit to `main`
44
# This step sets STEP to 2
55
# This step closes <details id=1> and opens <details id=2>
66

7-
# This will run every time we update or close the issue
7+
# This will run every time we push a commit to `main`
88
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
99

1010
on:
@@ -37,11 +37,12 @@ jobs:
3737

3838
# We will only run this action when:
3939
# 1. This repository isn't the template repository
40-
# 2. The STEP is currently 1 (see update-step.sh)
40+
# 2. The STEP is currently 1
4141
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
4242
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
43-
if: ${{ github.repository_owner != 'TBD-organization' }}
44-
&& needs.get_current_step.outputs.current_step == 1 }}
43+
if: >-
44+
${{ !github.event.repository.is_template
45+
&& needs.get_current_step.outputs.current_step == 1 }}
4546
4647
# We'll run Ubuntu for performance instead of Mac or Windows
4748
runs-on: ubuntu-latest
@@ -68,9 +69,8 @@ jobs:
6869
# and set STEP to '2'
6970
- name: Update to step 2
7071
if: steps.check_files.outputs.files_exists == 'true'
71-
run: ./.github/script/update-step.sh
72-
env:
73-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74-
FROM_STEP: 1
75-
TO_STEP: 2
76-
BRANCH_NAME: main
72+
uses: skills/action-update-step@v1
73+
with:
74+
token: ${{ secrets.GITHUB_TOKEN }}
75+
from_step: 1
76+
to_step: 2

‎.github/workflows/2-configure-your-action.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Step 2, Configure Your Action
22

3-
# This step triggers after TBD-step-2-event-desc
3+
# This step listens for the learner pushing a commit to `main`
44
# This step sets STEP to 3
55
# This step closes <details id=2> and opens <details id=3>
66

7-
# This will run every time we TBD-step-2-event-desc
7+
# This will run every time we push a commit to `main`
88
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
99
on:
1010
workflow_dispatch:
@@ -36,11 +36,12 @@ jobs:
3636

3737
# We will only run this action when:
3838
# 1. This repository isn't the template repository
39-
# 2. The STEP is currently 2 (see update-step.sh)
39+
# 2. The STEP is currently 2
4040
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
4141
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
42-
if: ${{ github.repository_owner != 'TBD-organization' }}
43-
&& needs.get_current_step.outputs.current_step == 2 }}
42+
if: >-
43+
${{ !github.event.repository.is_template
44+
&& needs.get_current_step.outputs.current_step == 2 }}
4445
4546
# We'll run Ubuntu for performance instead of Mac or Windows
4647
runs-on: ubuntu-latest
@@ -68,9 +69,8 @@ jobs:
6869
# and set STEP to '3'
6970
- name: Update to step 3
7071
if: steps.check_files.outputs.files_exists == 'true'
71-
run: ./.github/script/update-step.sh
72-
env:
73-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74-
FROM_STEP: 2
75-
TO_STEP: 3
76-
BRANCH_NAME: main
72+
uses: skills/action-update-step@v1
73+
with:
74+
token: ${{ secrets.GITHUB_TOKEN }}
75+
from_step: 2
76+
to_step: 3

‎.github/workflows/3-create-metadata-file.yml

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Step 3, Create Metadata File
22

3-
# This step triggers after TBD-step-3-event-desc
3+
# This step listens for the learner pushing a commit to `main`
44
# This step sets STEP to 4
55
# This step closes <details id=3> and opens <details id=4>
66

7-
# This will run every time we TBD-step-3-event-desc
7+
# This will run every time we push a commit to `main`
88
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
99
on:
1010
workflow_dispatch:
@@ -38,11 +38,12 @@ jobs:
3838

3939
# We will only run this action when:
4040
# 1. This repository isn't the template repository
41-
# 2. The STEP is currently 2 (see update-step.sh)
41+
# 2. The STEP is currently 3
4242
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
4343
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
44-
if: ${{ github.repository_owner != 'TBD-organization' }}
45-
&& needs.get_current_step.outputs.current_step == 3 }}
44+
if: >-
45+
${{ !github.event.repository.is_template
46+
&& needs.get_current_step.outputs.current_step == 3 }}
4647
4748
# We'll run Ubuntu for performance instead of Mac or Windows
4849
runs-on: ubuntu-latest
@@ -70,9 +71,8 @@ jobs:
7071
# and set STEP to '4'
7172
- name: Update to step 4
7273
if: (contains(steps.read_action_yml_file.outputs.contents, ${{ env.EXPECTED_METADATA }})
73-
run: ./.github/script/update-step.sh
74-
env:
75-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76-
FROM_STEP: 3
77-
TO_STEP: 4
78-
BRANCH_NAME: main
74+
uses: skills/action-update-step@v1
75+
with:
76+
token: ${{ secrets.GITHUB_TOKEN }}
77+
from_step: 3
78+
to_step: 4

‎.github/workflows/4-create-javascript-files-for-action.yml

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Step 4, Create JavaScript Files For Action
22

3-
# This step triggers after TBD-step-3-event-desc
4-
# This step sets STEP to 4
5-
# This step closes <details id=3> and opens <details id=4>
3+
# This step listens for the learner pushing a commit to `main`
4+
# This step sets STEP to 5
5+
# This step closes <details id=4> and opens <details id=5>
66

7-
# This will run every time we TBD-step-3-event-desc
7+
# This will run every time we push a commit to `main`
88
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
99
on:
1010
workflow_dispatch:
@@ -35,11 +35,12 @@ jobs:
3535

3636
# We will only run this action when:
3737
# 1. This repository isn't the template repository
38-
# 2. The STEP is currently 2 (see update-step.sh)
38+
# 2. The STEP is currently 4
3939
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
4040
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
41-
if: ${{ github.repository_owner != 'TBD-organization' }}
42-
&& needs.get_current_step.outputs.current_step == 4 }}
41+
if: >-
42+
${{ !github.event.repository.is_template
43+
&& needs.get_current_step.outputs.current_step == 4 }}
4344
4445
# We'll run Ubuntu for performance instead of Mac or Windows
4546
runs-on: ubuntu-latest
@@ -67,9 +68,8 @@ jobs:
6768
# and set STEP to '5'
6869
- name: Update to step 5
6970
if: steps.check_files.outputs.files_exists == 'true'
70-
run: ./.github/script/update-step.sh
71-
env:
72-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73-
FROM_STEP: 4
74-
TO_STEP: 5
75-
BRANCH_NAME: main
71+
uses: skills/action-update-step@v1
72+
with:
73+
token: ${{ secrets.GITHUB_TOKEN }}
74+
from_step: 4
75+
to_step: 5

‎.github/workflows/5-add-action-to-workflow-file.yml

+13-13
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Step 5, Add Action To Workflow File
22

3-
# This step triggers after TBD-step-3-event-desc
4-
# This step sets STEP to 4
5-
# This step closes <details id=3> and opens <details id=4>
3+
# This step listens for the learner pushing a commit to `main`
4+
# This step sets STEP to 6
5+
# This step closes <details id=5> and opens <details id=6>
66

7-
# This will run every time we TBD-step-3-event-desc
7+
# This will run every time we push a commit to `main`
88
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
99
on:
1010
workflow_dispatch:
@@ -38,11 +38,12 @@ jobs:
3838

3939
# We will only run this action when:
4040
# 1. This repository isn't the template repository
41-
# 2. The STEP is currently 2 (see update-step.sh)
41+
# 2. The STEP is currently 5
4242
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
4343
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
44-
if: ${{ github.repository_owner != 'TBD-organization' }}
45-
&& needs.get_current_step.outputs.current_step == 5 }}
44+
if: >-
45+
${{ !github.event.repository.is_template
46+
&& needs.get_current_step.outputs.current_step == 5 }}
4647
4748
# We'll run Ubuntu for performance instead of Mac or Windows
4849
runs-on: ubuntu-latest
@@ -70,9 +71,8 @@ jobs:
7071
# and set STEP to '6'
7172
- name: Update to step 6
7273
if: (contains(steps.read_action_yml_file.outputs.contents, ${{ env.EXPECTED_METADATA }})
73-
run: ./.github/script/update-step.sh
74-
env:
75-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76-
FROM_STEP: 5
77-
TO_STEP: 6
78-
BRANCH_NAME: main
74+
uses: skills/action-update-step@v1
75+
with:
76+
token: ${{ secrets.GITHUB_TOKEN }}
77+
from_step: 5
78+
to_step: 6

‎.github/workflows/6-trigger-action.yml

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: Step 6, Trigger Your Action
22

3-
# This step triggers after TBD-step-3-event-desc
4-
# This step sets STEP to 4
5-
# This step closes <details id=3> and opens <details id=4>
3+
# This step listens for the learner applying a label to an issue
4+
# This step sets STEP to X
5+
# This step closes <details id=6> and opens <details id=X>
66

7-
# This will run every time we TBD-step-3-event-desc
7+
# This will run every time we apply a label to an issue
88
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
99
on:
1010
workflow_dispatch:
@@ -38,11 +38,12 @@ jobs:
3838

3939
# We will only run this action when:
4040
# 1. This repository isn't the template repository
41-
# 2. The STEP is currently 2 (see update-step.sh)
41+
# 2. The STEP is currently 6
4242
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
4343
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
44-
if: ${{ github.repository_owner != 'TBD-organization' }}
45-
&& needs.get_current_step.outputs.current_step == 6 }}
44+
if: >-
45+
${{ !github.event.repository.is_template
46+
&& needs.get_current_step.outputs.current_step == 6 }}
4647
4748
# We'll run Ubuntu for performance instead of Mac or Windows
4849
runs-on: ubuntu-latest
@@ -59,13 +60,12 @@ jobs:
5960
run: echo '${{ toJSON(github.event) }}'
6061

6162
# Update README to close <details id=6>
62-
# and open <details id=7>
63-
# and set STEP to '6'
64-
- name: Update to step 7
63+
# and open <details id=X>
64+
# and set STEP to 'X'
65+
- name: Update to step X
6566
if: contains(github.event, ${{ env.EXPECTED_METADATA }})
66-
run: ./.github/script/update-step.sh
67-
env:
68-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69-
FROM_STEP: 6
70-
TO_STEP: 7
71-
BRANCH_NAME: main
67+
uses: skills/action-update-step@v1
68+
with:
69+
token: ${{ secrets.GITHUB_TOKEN }}
70+
from_step: 6
71+
to_step: X

‎.github/workflows/my-workflow.yml

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
ame: JS Actions
1+
name: JS Actions
22

33
on:
44
issues:
55
types: [labeled]
66

77
jobs:
88
action:
9-
runs-on: ubuntu-latest
9+
if: ${{ !github.event.repository.is_template }}
10+
runs-on: ubuntu-latest
1011

11-
steps:
12-
- uses: actions/checkout@v3
12+
steps:
13+
- uses: actions/checkout@v3

‎README.md

+16-12
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ _In our case, we will use this one **workflow** file for many things, which lead
6262

6363
Read more about [workflows](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/configuring-a-workflow#choosing-the-type-of-actions-for-your-workflow)
6464

65-
<details id=1 close>
65+
<details id=1>
6666

6767
<summary><h2> Step 1: Initialize a new JavaScript project</h2></summary>
6868

@@ -183,10 +183,10 @@ This file defines the following information about your action:
183183
| ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ | :----------------: |
184184
| Name | The name of your action. Helps visually identify the actions in a job. | :white_check_mark: |
185185
| Description | A summary of what your action does. | :white_check_mark: |
186-
| Inputs | Input parameters allow you to specify data that the action expects to use during runtime. These parameters become environment variables in the runner. | |
187-
| Outputs | Specifies the data that subsequent actions can use later in the workflow after the action that defines these outputs has run. | |
186+
| Inputs | Input parameters allow you to specify data that the action expects to use during runtime. These parameters become environment variables in the runner. | :x: |
187+
| Outputs | Specifies the data that subsequent actions can use later in the workflow after the action that defines these outputs has run. | :x: |
188188
| Runs | The command to run when the action executes. | :white_check_mark: |
189-
| Branding | You can use a color and Feather icon to create a badge to personalize and distinguish your action in GitHub Marketplace. | |
189+
| Branding | You can use a color and Feather icon to create a badge to personalize and distinguish your action in GitHub Marketplace. | :x: |
190190

191191
---
192192

@@ -397,25 +397,29 @@ All of the following steps will add the action to the workflow file that’s alr
397397
### Activity 1: Edit the custom action at the bottom of the workflow file.
398398
399399
```yaml
400-
- name: ha-ha
401-
uses: ./.github/actions/joke-action
400+
- name: ha-ha
401+
uses: ./.github/actions/joke-action
402402
```
403403
404404
Here is what the full file should look like (we’re using issues instead of the pull request event and removing the reference to the hello world action.)
405405
406406
```yaml
407407
name: JS Actions
408+
408409
on:
409410
issues:
410411
types: [labeled]
411412

412413
jobs:
413414
action:
414-
runs-on: ubuntu-latest
415-
steps:
416-
- uses: actions/checkout@v3
417-
- name: ha-ha
418-
uses: ./.github/actions/joke-action
415+
if: ${{ !github.event.repository.is_template }}
416+
runs-on: ubuntu-latest
417+
418+
steps:
419+
- uses: actions/checkout@v3
420+
- name: ha-ha
421+
uses: ./.github/actions/joke-action
422+
419423
```
420424
421425
</details>
@@ -436,7 +440,7 @@ Everything is all set up and now we are ready to start laughing. You will find y
436440
437441
</details>
438442
439-
<details id=7>
443+
<details id=X>
440444
<summary><h2>Finish</h2></summary>
441445
442446
### Congratulations, you've completed this course!

0 commit comments

Comments
 (0)