Skip to content

Commit 587480b

Browse files
authored
Updates to match template (workflows) (#1)
* Updates to match template * Fix indents in workflows * Fix 4-personalize-codespace.yml * Create dependabot.yml
1 parent b521150 commit 587480b

6 files changed

+75
-54
lines changed

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "monthly"

.github/workflows/0-start.yml

+11-5
Original file line numberDiff line numberDiff line change
@@ -17,34 +17,40 @@ permissions:
1717
contents: write
1818

1919
jobs:
20+
# Get the current step from .github/script/STEP so we can
21+
# limit running the main job when the learner is on the same step.
2022
get_current_step:
2123
name: Check current step number
2224
runs-on: ubuntu-latest
2325
steps:
2426
- name: Checkout
25-
uses: actions/checkout@v2
27+
uses: actions/checkout@v3
2628
- id: get_step
27-
run: echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
29+
run: |
30+
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
2831
outputs:
2932
current_step: ${{ steps.get_step.outputs.current_step }}
30-
33+
3134
on_start:
3235
name: On start
3336
needs: get_current_step
3437

3538
# We will only run this action when:
3639
# 1. This repository isn't the template repository
40+
# 2. The STEP is currently 0
3741
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
3842
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
39-
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 0}}
43+
if: >-
44+
${{ !github.event.repository.is_template
45+
&& needs.get_current_step.outputs.current_step == 0}}
4046
4147
# We'll run Ubuntu for performance instead of Mac or Windows
4248
runs-on: ubuntu-latest
4349

4450
steps:
4551
# We'll need to check out the repository so that we can edit the README
4652
- name: Checkout
47-
uses: actions/checkout@v2
53+
uses: actions/checkout@v3
4854
with:
4955
fetch-depth: 0 # Let's get all the branches
5056

.github/workflows/1-first-codespace.yml

+14-10
Original file line numberDiff line numberDiff line change
@@ -19,38 +19,42 @@ permissions:
1919
contents: write
2020

2121
jobs:
22-
# The purpose of this job is to output the current step number
23-
# (retreived from the STEP file). This output variable can
24-
# then be referenced in other jobs and used in conditional
25-
# expressions.
22+
# Get the current step from .github/script/STEP so we can
23+
# limit running the main job when the learner is on the same step.
2624
get_current_step:
2725
name: Check current step number
2826
runs-on: ubuntu-latest
2927
steps:
3028
- name: Checkout
31-
uses: actions/checkout@v2
29+
uses: actions/checkout@v3
3230
- id: get_step
33-
run: echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
31+
run: |
32+
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
3433
outputs:
3534
current_step: ${{ steps.get_step.outputs.current_step }}
36-
35+
3736
on_add_dependency:
3837
name: On Add dependency
3938
needs: get_current_step
4039

4140
# We will only run this action when:
4241
# 1. This repository isn't the template repository
42+
# 2. The STEP is currently 1
4343
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
4444
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
45-
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 1 }}
45+
if: >-
46+
${{ !github.event.repository.is_template
47+
&& needs.get_current_step.outputs.current_step == 1 }}
4648
4749
# We'll run Ubuntu for performance instead of Mac or Windows
4850
runs-on: ubuntu-latest
4951

5052
steps:
5153
# We'll need to check out the repository so that we can edit the README
5254
- name: Checkout
53-
uses: actions/checkout@v2
55+
uses: actions/checkout@v3
56+
with:
57+
fetch-depth: 0 # Let's get all the branches
5458

5559
# Verify the learner added the file contents
5660
- name: Check workflow contents, jobs
@@ -60,7 +64,7 @@ jobs:
6064
env:
6165
FILE: "index.html"
6266
SEARCH: "Hello from the codespace"
63-
67+
6468
# Update README to close <details id=1> and open <details id=2>
6569
# and set STEP to '2'
6670
- name: Update to step 2

.github/workflows/2-custom-image.yml

+12-11
Original file line numberDiff line numberDiff line change
@@ -19,51 +19,52 @@ permissions:
1919
contents: write
2020

2121
jobs:
22-
# The purpose of this job is to output the current step number
23-
# (retreived from the STEP file). This output variable can
24-
# then be referenced in other jobs and used in conditional
25-
# expressions.
22+
# Get the current step from .github/script/STEP so we can
23+
# limit running the main job when the learner is on the same step.
2624
get_current_step:
2725
name: Check current step number
2826
runs-on: ubuntu-latest
2927
steps:
3028
- name: Checkout
31-
uses: actions/checkout@v2
29+
uses: actions/checkout@v3
3230
- id: get_step
33-
run: echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
31+
run: |
32+
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
3433
outputs:
3534
current_step: ${{ steps.get_step.outputs.current_step }}
36-
35+
3736
on_DependabotPrCreated:
3837
name: On Creation of a PR
3938
needs: get_current_step
4039

4140
# We will only run this action when:
4241
# 1. This repository isn't the template repository
42+
# 2. The STEP is currently 2
4343
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
4444
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
45-
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 2 }}
45+
if: >-
46+
${{ !github.event.repository.is_template
47+
&& needs.get_current_step.outputs.current_step == 2 }}
4648
4749
# We'll run Ubuntu for performance instead of Mac or Windows
4850
runs-on: ubuntu-latest
4951

5052
steps:
5153
# We'll need to check out the repository so that we can edit the README
5254
- name: Checkout
53-
uses: actions/checkout@v2
55+
uses: actions/checkout@v3
5456
with:
5557
fetch-depth: 0 # Let's get all the branches
5658

5759
# Verify the devcontainer.json has an image
58-
- name: Check package.json
60+
- name: Check devcontainer.json
5961
run: |
6062
chmod a+x .github/script/check-file.sh
6163
./.github/script/check-file.sh
6264
env:
6365
FILE: ".devcontainer/devcontainer.json"
6466
SEARCH: "mcr.microsoft.com/vscode/devcontainers/universal:latest"
6567

66-
6768
# Update README to close <details id=2> and open <details id=3>
6869
# and set STEP to '3'
6970
- name: Update to step 3

.github/workflows/3-customize-codespace.yml

+13-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Step 3, 3-Customize Codespace
22

33
# This step triggers after TBD-step-3-event-desc
44
# This step sets STEP to 4
5-
# This step closes <details id=3> and opens <details id=X>
5+
# This step closes <details id=3> and opens <details id=4>
66

77
# This will run every time
88
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
@@ -19,38 +19,40 @@ permissions:
1919
contents: write
2020

2121
jobs:
22-
# The purpose of this job is to output the current step number
23-
# (retreived from the STEP file). This output variable can
24-
# then be referenced in other jobs and used in conditional
25-
# expressions.
22+
# Get the current step from .github/script/STEP so we can
23+
# limit running the main job when the learner is on the same step.
2624
get_current_step:
2725
name: Check current step number
2826
runs-on: ubuntu-latest
2927
steps:
3028
- name: Checkout
31-
uses: actions/checkout@v2
29+
uses: actions/checkout@v3
3230
- id: get_step
33-
run: echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
31+
run: |
32+
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
3433
outputs:
3534
current_step: ${{ steps.get_step.outputs.current_step }}
36-
35+
3736
on_DependabotSecurityUpdates:
3837
name: On Dependabot Security Updates
3938
needs: get_current_step
4039

4140
# We will only run this action when:
4241
# 1. This repository isn't the template repository
42+
# 2. The STEP is currently 3
4343
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
4444
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
45-
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 3 }}
45+
if: >-
46+
${{ !github.event.repository.is_template
47+
&& needs.get_current_step.outputs.current_step == 3 }}
4648
4749
# We'll run Ubuntu for performance instead of Mac or Windows
4850
runs-on: ubuntu-latest
4951

5052
steps:
5153
# We'll need to check out the repository so that we can edit the README
5254
- name: Checkout
53-
uses: actions/checkout@v2
55+
uses: actions/checkout@v3
5456
with:
5557
fetch-depth: 0 # Let's get all the branches
5658

@@ -62,8 +64,7 @@ jobs:
6264
env:
6365
FILE: ".devcontainer/devcontainer.json"
6466
SEARCH: "postCreateCommand"
65-
66-
67+
6768
# Update README to close <details id=3> and open <details id=4>
6869
# and set STEP to '4'
6970
- name: Update to step 4

.github/workflows/4-personalize-codespace.yml

+19-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: Step 4, 4-Personalize your Codespace
2+
23
# This step triggers after TBD-step-4-event-desc
34
# This step sets STEP to X
4-
# This step closes <details id=3> and opens <details X>
5+
# This step closes <details id=4> and opens <details X>
56

67
# This will run every time we TBD-step-4-event-desc
78
# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
@@ -11,47 +12,49 @@ on:
1112
branches:
1213
- main
1314
paths:
14-
- '.github/dependabot.yml'
15-
15+
- 'setup.sh'
16+
1617
# Reference https://docs.github.com/en/actions/security-guides/automatic-token-authentication
1718
permissions:
1819
# Need `contents: read` to checkout the repository
1920
# Need `contents: write` to update the step metadata
2021
contents: write
2122

2223
jobs:
23-
# The purpose of this job is to output the current step number
24-
# (retreived from the STEP file). This output variable can
25-
# then be referenced in other jobs and used in conditional
26-
# expressions.
24+
# Get the current step from .github/script/STEP so we can
25+
# limit running the main job when the learner is on the same step.
2726
get_current_step:
2827
name: Check current step number
2928
runs-on: ubuntu-latest
3029
steps:
3130
- name: Checkout
32-
uses: actions/checkout@v2
31+
uses: actions/checkout@v3
3332
- id: get_step
34-
run: echo "::set-output name=current_step::$(cat ./.github/script/STEP)"
33+
run: |
34+
echo "current_step=$(cat ./.github/script/STEP)" >> $GITHUB_OUTPUT
3535
outputs:
3636
current_step: ${{ steps.get_step.outputs.current_step }}
37-
37+
3838
on_TBD-step-4-event:
3939
name: On TBD-step-4-event
4040
needs: get_current_step
4141

4242
# We will only run this action when:
4343
# 1. This repository isn't the template repository
44+
# 2. The STEP is currently 4
4445
# Reference https://docs.github.com/en/actions/learn-github-actions/contexts
4546
# Reference https://docs.github.com/en/actions/learn-github-actions/expressions
46-
if: ${{ !github.event.repository.is_template && needs.get_current_step.outputs.current_step == 4}}
47+
if: >-
48+
${{ !github.event.repository.is_template
49+
&& needs.get_current_step.outputs.current_step == 4}}
4750
4851
# We'll run Ubuntu for performance instead of Mac or Windows
4952
runs-on: ubuntu-latest
5053

5154
steps:
5255
# We'll need to check out the repository so that we can edit the README
5356
- name: Checkout
54-
uses: actions/checkout@v2
57+
uses: actions/checkout@v3
5558
with:
5659
fetch-depth: 0 # Let's get all the branches
5760

@@ -61,10 +64,10 @@ jobs:
6164
chmod a+x .github/script/check-file.sh
6265
./.github/script/check-file.sh
6366
env:
64-
FILE: "dotfiles/setup.sh"
65-
SEARCH: "Codespace"
66-
67-
# Update README to close <details id=3> and open <details id=X>
67+
FILE: "setup.sh"
68+
SEARCH: "install sl"
69+
70+
# Update README to close <details id=4> and open <details id=X>
6871
# and set STEP to 'X'
6972
- name: Update to step X
7073
uses: skills/action-update-step@v1

0 commit comments

Comments
 (0)