Skip to content

Commit

Permalink
Updates to match template (#12)
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 authored Feb 14, 2023
1 parent 682cbdd commit 7dc2e3c
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 9 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-resolve-a-merge-conflict.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,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_resolve_merge_conflict:
name: On resolve merge conflict

# 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-create-your-own-conflict.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,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_references_md:
name: On create references.md

# 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-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 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
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ _Learn why conflicts happen and how to resolve them._
Do not use quotes on the <details> tag attributes.
-->

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

Merge conflicts happen when two people make changes to the same file on GitHub—a common occurrence when you’re working with others. While resolving differences might involve some discussion, merge conflicts don’t have to be scary. This course guides you through the steps to finding the best merge conflict solution, so your team can keep building.

Expand All @@ -30,15 +31,15 @@ Merge conflicts happen when two people make changes to the same file on GitHub

## 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/resolve-merge-conflicts/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 7dc2e3c

Please sign in to comment.