diff --git a/.github/steps/1-create-a-pr.md b/.github/steps/1-create-a-pr.md deleted file mode 100644 index 879e8e6..0000000 --- a/.github/steps/1-create-a-pr.md +++ /dev/null @@ -1,12 +0,0 @@ -## Step 1: Create a pull request - -_Welcome to "Managing Merge Conflicts"! :wave:_ - -**What is a _merge conflict_?**: A **merge conflict** occurs when changes are made to the same part of the same file on two different branches. You usually find out about conflicts in a pull request so let's start by creating one. - -### :keyboard: Activity: Create a pull request - -1. Open this repo in a new browser tab, and work on the steps in your second tab while you read the instructions in this tab. -1. We made a small change to a file in the repository in the `my-resume` branch. -1. On the new tab, navigate to the "Pull requests" tab at the top of your page, then [Create a pull request](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request) setting `my-resume` as the head branch and `main` as the base branch. You can enter `Resolving merge conflicts` for the pull request title and body. -1. Now that your pull request is opened, Mona should already be busy checking your work. Give her a moment and keep watch in the comments. You will see her respond with progress info and the next lesson. diff --git a/.github/steps/1-step.md b/.github/steps/1-step.md new file mode 100644 index 0000000..17c7f42 --- /dev/null +++ b/.github/steps/1-step.md @@ -0,0 +1,49 @@ +## Step 1: Learn about merge conflicts + +### What is a merge conflict? + +A **merge conflict** occurs when changes are made to the same part of the same file on two different branches. + +```mermaid +gitGraph + checkout main + commit id: "Initial" + commit id: "Add resume.md" + + branch my-resume + checkout my-resume + commit id: "Update skills" + + checkout main + commit id: "Also update skills" + + checkout my-resume + commit id: "Other changes" + + checkout main + merge my-resume id: "Conflict!" +``` + +**What's happening here:** + +1. We start with a repository and add a `resume.md` file. +2. We create a new branch called `my-resume` and update the skills area. +3. At the same time, someone else also updates the skills area on the `main` branch. +4. We add other unrelated changes to the `my-resume` branch. +5. When we try to merge `my-resume` into `main`, we get a **conflict!** Both branches modified the same part of `resume.md`. + +### ⌨️ Activity: Create a pull request + +To quickly practice, we already created the above scenario for you by making a new branch `my-resume` then modifying `resume.md` on both branches, which will will cause a conflict. Let's practice with it! + +1. Open this repo in a new browser tab, and work on the steps in your second tab while you read the instructions in this tab. + +1. In the top navigation, select the **Pull requests** tab. + +1. Click the **New pull request** button and use the following settings: + + - Base: `main` + - Compare: `my-resume` + - Title: `Resolve a merge conflict` + +1. With the new pull request opened, Mona will share the next steps. diff --git a/.github/steps/2-resolve-a-merge-conflict.md b/.github/steps/2-resolve-a-merge-conflict.md deleted file mode 100644 index c133153..0000000 --- a/.github/steps/2-resolve-a-merge-conflict.md +++ /dev/null @@ -1,21 +0,0 @@ -## Step 2: Resolve a merge conflict - -_Good start! Now let's look deeper at a merge conflict! :mag:_ - -This can be intimidating, but have no fear, Git is smart when it comes to merging! Git only needs a human to decide how to [resolve the conflict](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line). Sometimes, the best way to resolve a merge conflict is to add content that's from both branches, or even something that isn't on either! This is why Git needs a human to look at the code and make the proper fixes. - -### :keyboard: Activity: Resolve a merge conflict - -1. Open the pull request that you just created, we created a conflict for you. Have no fear! -1. At the bottom of the page, under "This branch has conflicts that must be resolved", click the **Resolve conflicts** button. -1. Look for the highlighted sections that begins with `<<<<<<< my-resume` and ends with `>>>>>>> main`. These markers are added by Git to show you the content that is in conflict. -1. Remove the changes made on the main branch by deleting all of the content below the `=======` and above `>>>>>>> main`. -1. Next, remove the merge conflict markers by deleting the following lines: - ``` - <<<<<<< my-resume - ======= - >>>>>>> main - ``` -1. With the merge conflict markers removed, click **Mark as resolved**. -1. Finally, click **Commit merge**. -1. Now that the conflict is resolved, Mona should already be busy checking your work. Give her a moment and keep watch in the comments. You will see her respond with progress info and the next lesson. diff --git a/.github/steps/2-step.md b/.github/steps/2-step.md new file mode 100644 index 0000000..691e95e --- /dev/null +++ b/.github/steps/2-step.md @@ -0,0 +1,80 @@ +## Step 2: Resolve a merge conflict + +Managing conflicts can be intimidating, but have no fear, Git is smart with merging! Git only needs a human to decide when the situation is very unclear. + +You typically have 3 options for managing a conflict: + +1. Accept the version from the base branch. +1. Accept the version from the compare branch. +1. Manually combined the changes from both branches. + +> [!TIP] +> You can learn more about managing conflicts on the [GitHub Docs: resolve the conflict](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/addressing-merge-conflicts/resolving-a-merge-conflict-using-the-command-line) page. + +### When should I resolve a conflict? + +Conflicts can be resolved as soon as they are noticed. Resolving a conflict doesn't automatically merge the pull request in GitHub. Instead, it stores the conflict's resolution as a **reverse merge** commit, allowing you to keep working on your branch as normal. + +This means that some changes from the `base` branch (`main`) are merged into the `compare` branch (`my-resume`). Only the `compare` branch is updated, which allows you to test the resolved changes before merging. + +```mermaid +gitGraph + checkout main + commit id: "Initial" + commit id: "Add resume.md" + + branch my-resume + checkout my-resume + commit id: "Update skills" + + checkout main + commit id: "Also update skills" + + checkout my-resume + commit id: "Other changes" + + checkout my-resume + merge main id: "Resolve conflict" + commit id: "Continue work" + + checkout main + merge my-resume id: "Success!" + +``` + +### ⌨️ Activity: Resolve a merge conflict + +1. If needed, open the recently created pull request. + +1. Scroll to the bottom of the page. Near the merge button, notice a message indicating there are conflicts to be resolved. + +1. Press the **Resolve conflicts** button to open a special text editor for handling merge conflicts. + +1. Look for a highlighted section similar to the below, which shows both versions of the conflict. + + ```txt + <<<<<<< my-resume + - Contributed to open source projects + ======= + - Built internal tools + >>>>>>> main + ``` + +1. After some inspection, we decide to keep the version from the compare branch. Remove the base branch version by deleting then content between `=======` and `>>>>>>> main`. + + ```txt + <<<<<<< my-resume + - Contributed to open source projects + ======= + >>>>>>> main + ``` + +1. With our manual changes finished, let's remove the merge conflict markers. Only the content from the compare branch will remain. + + ```txt + - Contributed to open source projects + ``` + +1. In the top right, click the **Mark as resolved** button and choose **Commit merge**. + +1. With the conflict resolved, Mona will share the next steps. diff --git a/.github/steps/3-create-your-own-conflict.md b/.github/steps/3-create-your-own-conflict.md deleted file mode 100644 index b122e39..0000000 --- a/.github/steps/3-create-your-own-conflict.md +++ /dev/null @@ -1,21 +0,0 @@ -## Step 3: Create your own conflict - -_Good job! You've solved a merge conflict! :tada:_ - -Resolving a conflict doesn't automatically merge the pull request in GitHub. Instead, it stores the resolution of the conflict in a merge commit and allows you and your team to keep working. To resolve a conflict, GitHub performs what is known as a _reverse merge_. This means that the changes from the `main` branch were merged into your `my-resume` branch. With a reverse merge, only the `my-resume` branch is updated. This allows you to test the resolved changes on your branch before you merge it into `main`. - -Now, let's get a little evil. (It's for educational purposes!) - -### :keyboard: Activity: Create your own conflict - -We went ahead and added a new file called `references.md` and pushed that change to `main`, without updating your `my-resume` branch. - -1. Browse and switch to the `my-resume` branch. -1. Click the `Add file` dropdown menu and then on `Create new file`. -1. Create a file named `references.md`. -1. Enter some text that conflicts with what we added for `references.md` in the `main` branch. -1. Click the **Commit changes** button at the top right of the editor. In the Commit message modal that appears: - - Enter a commit message (e.g., Create references.md). - - Make sure the "Commit directly to the `my-resume` branch" option is selected. - - Click the green "Commit changes" button to finish. -1. Now that you've created a new conflict, Mona should already be busy checking your work. Give her a moment and keep watch in the comments. You will see her respond with progress info and the next lesson. diff --git a/.github/steps/3-step.md b/.github/steps/3-step.md new file mode 100644 index 0000000..94a5b2c --- /dev/null +++ b/.github/steps/3-step.md @@ -0,0 +1,12 @@ +## Step 3: Merge your pull request + +Nice work! All that remains is to merge! +Yep, that's it! Merge conflicts can be easy! 🥰 + +### ⌨️ Activity: Merge your pull request + +1. Click the **Merge pull request** button. + +1. (optional) Delete the branch `my-resume`. + +1. With the pull request merged, Mona will share a final review then update the readme to share your success. Nice work! 😎 diff --git a/.github/steps/4-merge-your-pull-request.md b/.github/steps/4-merge-your-pull-request.md deleted file mode 100644 index 1089e63..0000000 --- a/.github/steps/4-merge-your-pull-request.md +++ /dev/null @@ -1,13 +0,0 @@ -## Step 4: Merge your pull request - -_Almost there! :heart:_ - -You can now [merge](https://docs.github.com/en/get-started/quickstart/github-glossary#merge) your pull request! - -### :keyboard: Activity: Merge your pull request - -1. First, resolve any remaining conflicts in your pull request. - > Look back at step one if you need help. -1. Click **Merge pull request**. -1. Delete the branch `my-resume` (optional). -1. Now that your pull request is merged, Mona should already be busy checking your work. Give her a moment and keep watch in the comments. You will see her respond with progress info and the next lesson. diff --git a/.github/steps/X-finish.md b/.github/steps/X-finish.md deleted file mode 100644 index 70558f3..0000000 --- a/.github/steps/X-finish.md +++ /dev/null @@ -1,19 +0,0 @@ -## Finish - -_Congratulations friend, you've completed this exercise!_ - -celebrate - -Here's a recap of all the tasks you've accomplished in your repository: - -- You learned why merge conflicts happen. -- You resolved a simple merge conflict. -- You created a merge conflict, and resolved it! - -### What's next? - -- Make your own Markdown resume site with GitHub Pages! Learn how in our [GitHub Pages](https://github.com/skills/github-pages) exercise. -- We'd love to hear what you thought of this exercise [in our discussion board](https://github.com/orgs/skills/discussions/categories/resolve-merge-conflicts). -- [Take another GitHub Skills exercise](https://github.com/skills). -- [Read the GitHub Getting Started docs](https://docs.github.com/en/get-started). -- To find projects to contribute to, check out [GitHub Explore](https://github.com/explore). diff --git a/.github/steps/x-review.md b/.github/steps/x-review.md new file mode 100644 index 0000000..379667a --- /dev/null +++ b/.github/steps/x-review.md @@ -0,0 +1,20 @@ +## Review + +celebrate + +Congratulations! You've successfully completed the **Resolve Merge Conflicts** exercise. 🎉 + +You've learned essential skills for collaborative development on GitHub: + +- **Understanding merge conflicts**: You now know why conflicts occur when multiple people edit the same file +- **Identifying conflicts**: You can recognize when GitHub detects merge conflicts in pull requests +- **Resolving conflicts**: You've practiced using GitHub's web editor to manually resolve conflicts by choosing which changes to keep +- **Merging successfully**: You completed the workflow by merging your pull request after resolving conflicts + +### What's next? + +Check out other [GitHub Skills exercises](https://learn.github.com/skills). + +- [GitHub Pages](https://github.com/skills-dev/github-pages) - Publish your own static website for free. +- [Communicate using Markdown](https://github.com/skills-dev/communicate-using-markdown) - Improve your documentation skills +- [Getting Started with GitHub Copilot](https://github.com/skills/getting-started-with-github-copilot) - Learn, build, debug and ship faster with an AI pair programmer. diff --git a/.github/workflows/0-start-exercise.yml b/.github/workflows/0-start-exercise.yml index 78b0f23..c740066 100644 --- a/.github/workflows/0-start-exercise.yml +++ b/.github/workflows/0-start-exercise.yml @@ -11,14 +11,14 @@ permissions: issues: write env: - STEP_1_FILE: ".github/steps/1-create-a-pr.md" + STEP_1_FILE: ".github/steps/1-step.md" jobs: start_exercise: if: | !github.event.repository.is_template name: Start Exercise - uses: skills/exercise-toolkit/.github/workflows/start-exercise.yml@v0.5.0 + uses: skills/exercise-toolkit/.github/workflows/start-exercise.yml@v0.7.0 with: exercise-title: "Resolve Merge Conflicts" intro-message: "Let's learn how to resolve merge conflicts when collaborating on GitHub." @@ -27,8 +27,6 @@ jobs: name: Prepare merge conflict runs-on: ubuntu-latest needs: [start_exercise] - env: - ISSUE_URL: ${{ needs.start_exercise.outputs.issue-url }} steps: - name: Checkout @@ -43,24 +41,25 @@ jobs: git config user.email github-actions[bot]@users.noreply.github.com echo "- Contributed to open source projects" >> resume.md git add resume.md - git commit -m "Add open source contribution" + git commit -m "Add open source experience" git push origin my-resume git checkout main git pull --rebase origin main - echo "- Built internal tools at Acme Corp" >> resume.md + echo "- Built internal tools" >> resume.md git add resume.md - git commit -m "Add Acme Corp experience" + git commit -m "Add internal experience" git push origin main env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - + post_next_step_content: name: Post next step content runs-on: ubuntu-latest - needs: [start_exercise, prepare_merge_conflict] + needs: [start_exercise] env: - ISSUE_URL: ${{ needs.start_exercise.outputs.issue-url }} + ISSUE_NUMBER: ${{ needs.start_exercise.outputs.issue-number }} + ISSUE_REPOSITORY: ${{ github.repository }} steps: - name: Checkout @@ -71,24 +70,24 @@ jobs: with: repository: skills/exercise-toolkit path: exercise-toolkit - ref: v0.5.0 + ref: v0.7.0 - name: Create comment - add step content - run: | - gh issue comment "$ISSUE_URL" \ - --body-file "$STEP_1_FILE" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: ${{ env.STEP_1_FILE }} - name: Create comment - watching for progress - run: | - gh issue comment "$ISSUE_URL" \ - --body-file "exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md - name: Enable next step workflow run: | gh workflow enable "Step 1" env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/1-create-a-pr.yml b/.github/workflows/1-create-a-pr.yml deleted file mode 100644 index e84865b..0000000 --- a/.github/workflows/1-create-a-pr.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Step 1 - -on: - pull_request_target: # Triggered when a PR is opened or synchronized even if there is a merge conflict unlike pull_request - branches: [main] - types: [opened] - -permissions: - issues: write - actions: write # Required for diabling and enabling workflows - pull-requests: write # Required for commenting or updating PR - -env: - STEP_2_FILE: ".github/steps/2-resolve-a-merge-conflict.md" - -jobs: - find_exercise: - name: Find Exercise Issue - uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.5.0 - - post_next_step_content: - name: Post next step content - needs: [find_exercise] - runs-on: ubuntu-latest - env: - ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }} - - steps: - - name: Checkout the base branch (main) - uses: actions/checkout@v4 - with: - ref: main - - - name: Get response templates - uses: actions/checkout@v4 - with: - repository: skills/exercise-toolkit - path: exercise-toolkit - ref: v0.5.0 - - - name: Create comment - add step content - run: | - gh issue comment "$ISSUE_URL" \ - --body-file "$STEP_2_FILE" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create comment - watching for progress - run: | - gh issue comment "$ISSUE_URL" \ - --body-file "exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Disable current workflow and enable next one - run: | - gh workflow disable "Step 1" - gh workflow enable "Step 2" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/1-step.yml b/.github/workflows/1-step.yml new file mode 100644 index 0000000..db7e0ee --- /dev/null +++ b/.github/workflows/1-step.yml @@ -0,0 +1,68 @@ +name: Step 1 + +on: + pull_request_target: + branches: [main] + types: [opened] + +permissions: + contents: read + actions: write + issues: write + +env: + STEP_2_FILE: ".github/steps/2-step.md" + +jobs: + find_exercise: + name: Find Exercise Issue + uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.7.0 + + post_next_step_content: + name: Post next step content + needs: [find_exercise] + runs-on: ubuntu-latest + env: + ISSUE_REPOSITORY: ${{ github.repository }} + ISSUE_NUMBER: ${{ needs.find_exercise.outputs.issue-number }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Get response templates + uses: actions/checkout@v4 + with: + repository: skills/exercise-toolkit + path: exercise-toolkit + ref: v0.7.0 + + - name: Create comment - step finished + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md + vars: | + next_step_number: 2 + + - name: Create comment - add step content + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: ${{ env.STEP_2_FILE }} + + - name: Create comment - watching for progress + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md + + - name: Disable current workflow and enable next one + run: | + gh workflow disable "${{github.workflow}}" + gh workflow enable "Step 2" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/2-resolve-a-merge-conflict.yml b/.github/workflows/2-resolve-a-merge-conflict.yml deleted file mode 100644 index 1fd2daa..0000000 --- a/.github/workflows/2-resolve-a-merge-conflict.yml +++ /dev/null @@ -1,81 +0,0 @@ -name: Step 2 - -on: - pull_request_target: - types: [synchronize] - branches: - - main - -permissions: - contents: write - actions: write - issues: write - pull-requests: write - -env: - STEP_3_FILE: ".github/steps/3-create-your-own-conflict.md" - -jobs: - find_exercise: - name: Find Exercise Issue - uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.5.0 - - post_next_step_content: - name: Post next step content - needs: [find_exercise] - runs-on: ubuntu-latest - env: - ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }} - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: main - - - name: Get response templates - uses: actions/checkout@v4 - with: - repository: skills/exercise-toolkit - path: exercise-toolkit - ref: v0.5.0 - - - name: Create and push a new file on main - run: | - set -e - - echo "Create new file" - printf "# References\n\n* octocat 1 😈" > references.md - - echo "Commit file" - git config user.name github-actions[bot] - git config user.email github-actions[bot]@users.noreply.github.com - git add references.md - git commit -m "Add references.md" - - echo "Push" - git push origin main - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create comment - add step content - run: | - gh issue comment "$ISSUE_URL" \ - --body-file "$STEP_3_FILE" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create comment - watching for progress - run: | - gh issue comment "$ISSUE_URL" \ - --body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Disable current workflow and enable next one - run: | - gh workflow disable "Step 2" - gh workflow enable "Step 3" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/2-step.yml b/.github/workflows/2-step.yml new file mode 100644 index 0000000..c47947f --- /dev/null +++ b/.github/workflows/2-step.yml @@ -0,0 +1,69 @@ +name: Step 2 + +on: + pull_request_target: + types: [synchronize] + branches: + - main + +permissions: + contents: read + actions: write + issues: write + +env: + STEP_3_FILE: ".github/steps/3-step.md" + +jobs: + find_exercise: + name: Find Exercise Issue + uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.7.0 + + post_next_step_content: + name: Post next step content + needs: [find_exercise] + runs-on: ubuntu-latest + env: + ISSUE_REPOSITORY: ${{ github.repository }} + ISSUE_NUMBER: ${{ needs.find_exercise.outputs.issue-number }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Get response templates + uses: actions/checkout@v4 + with: + repository: skills/exercise-toolkit + path: exercise-toolkit + ref: v0.7.0 + + - name: Create comment - step finished + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: exercise-toolkit/markdown-templates/step-feedback/step-finished-prepare-next-step.md + vars: | + next_step_number: 3 + + - name: Create comment - add step content + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: ${{ env.STEP_3_FILE }} + + - name: Create comment - watching for progress + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md + + - name: Disable current workflow and enable next one + run: | + gh workflow disable "${{github.workflow}}" + gh workflow enable "Step 3" + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/3-create-your-own-conflict.yml b/.github/workflows/3-create-your-own-conflict.yml deleted file mode 100644 index fb3d82b..0000000 --- a/.github/workflows/3-create-your-own-conflict.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Step 3 - -on: - pull_request_target: - types: - - synchronize - branches: - - main - -permissions: - contents: write - actions: write - issues: write - -env: - STEP_4_FILE: ".github/steps/4-merge-your-pull-request.md" - -jobs: - find_exercise: - name: Find Exercise Issue - uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.5.0 - - post_next_step_content: - name: Post next step content - needs: [find_exercise] - runs-on: ubuntu-latest - env: - ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }} - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Get response templates - uses: actions/checkout@v4 - with: - repository: skills/exercise-toolkit - path: exercise-toolkit - ref: v0.5.0 - - - name: Create comment - add step content - run: | - gh issue comment "$ISSUE_URL" \ - --body-file "$STEP_4_FILE" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create comment - watching for progress - run: | - gh issue comment "$ISSUE_URL" \ - --body-file exercise-toolkit/markdown-templates/step-feedback/watching-for-progress.md - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Disable current workflow and enable next one - run: | - gh workflow disable "Step 3" - gh workflow enable "Step 4" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/4-merge-your-pull-request.yml b/.github/workflows/3-step.yml similarity index 55% rename from .github/workflows/4-merge-your-pull-request.yml rename to .github/workflows/3-step.yml index 3ac44fb..274c0b3 100644 --- a/.github/workflows/4-merge-your-pull-request.yml +++ b/.github/workflows/3-step.yml @@ -1,4 +1,4 @@ -name: Step 4 +name: Step 3 on: pull_request: @@ -13,53 +13,50 @@ permissions: issues: write env: - REVIEW_FILE: ".github/steps/X-finish.md" + REVIEW_FILE: ".github/steps/x-review.md" jobs: find_exercise: - if: github.event.pull_request.merged == true + if: | + github.event.pull_request.merged == true && + github.head_ref == 'my-resume' name: Find Exercise Issue - uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.5.0 + uses: skills/exercise-toolkit/.github/workflows/find-exercise-issue.yml@v0.7.0 post_review_content: name: Post review content needs: [find_exercise] runs-on: ubuntu-latest - if: | - !github.event.repository.is_template && - github.head_ref == 'my-resume' && - github.event.pull_request.merged == true env: - ISSUE_URL: ${{ needs.find_exercise.outputs.issue-url }} + ISSUE_REPOSITORY: ${{ github.repository }} + ISSUE_NUMBER: ${{ needs.find_exercise.outputs.issue-number }} steps: - name: Checkout uses: actions/checkout@v4 - - name: Create comment - add step content - run: | - gh issue comment "$ISSUE_URL" \ - --body-file "$REVIEW_FILE" + - name: Get response templates + uses: actions/checkout@v4 + with: + repository: skills/exercise-toolkit + path: exercise-toolkit + ref: v0.7.0 + + - name: Create comment - add review content + uses: GrantBirki/comment@v2.1.1 + with: + repository: ${{ env.ISSUE_REPOSITORY }} + issue-number: ${{ env.ISSUE_NUMBER }} + file: ${{ env.REVIEW_FILE }} + + - name: Disable current workflow + run: gh workflow disable "${{github.workflow}}" env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} finish_exercise: name: Finish Exercise needs: [find_exercise, post_review_content] - uses: skills/exercise-toolkit/.github/workflows/finish-exercise.yml@v0.5.0 + uses: skills/exercise-toolkit/.github/workflows/finish-exercise.yml@v0.7.0 with: issue-url: ${{ needs.find_exercise.outputs.issue-url }} - - disable_workflow: - name: Disable this workflow - needs: [find_exercise, post_review_content] - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Disable current workflow - run: gh workflow disable "${{github.workflow}}" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 778422d..9941fb7 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,29 @@ -# Resolve merge conflicts +# Resolve Merge Conflicts _Learn why conflicts happen and how to resolve them._ ## Welcome -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. +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. -- **Who is this for**: New developers, new GitHub users, users new to Git, students, managers, teams. -- **What you'll learn**: What merge conflicts are, how you resolve merge conflicts, how to reduce merge conflicts. -- **What you'll build**: We'll work with a short Markdown resume file in this course. -- **Prerequisites**: We recommend taking [Introduction to GitHub](https://github.com/skills/introduction-to-github) prior to this course. -- **How long**: This course takes less than 30 minutes to complete. +- **Who is this for**: New developers, new Git and GitHub users +- **What you'll learn**: We'll introduce the tools for inspecting and resolving a merge conflict. +- **What you'll build**: You'll use a web editor to fix conflicting changes to Markdown file. +- **Prerequisites**: + - Skills Exercise: [Introduction to GitHub](https://github.com/skills-dev/introduction-to-github) +- **How long**: less than 30 minutes In this exercise, you will: -1. Create a pull request -2. Resolve a merge conflict -3. Create a merge conflict -4. Merge your pull request +1. Learn the causes of a merge conflict. +2. The tools for resolving a merge conflict. +3. When and how to resolve a merge conflict. ### How to start this course Simply copy the exercise to your account, then give your favorite Octocat (Mona) **about 20 seconds** to prepare the first lesson, then **refresh the page**. -[![](https://img.shields.io/badge/Copy%20Exercise-%E2%86%92-1f883d?style=for-the-badge&logo=github&labelColor=197935)](https://github.com/new?template_owner=Chukslord1&template_name=resolve-merge-conflicts&owner=%40me&name=skills-resolve-merge-conflicts&description=Exercise:+Resolve+Merge+Conflicts&visibility=public) +[![](https://img.shields.io/badge/Copy%20Exercise-%E2%86%92-1f883d?style=for-the-badge&logo=github&labelColor=197935)](https://github.com/new?template_owner=skills-dev-2&template_name=resolve-merge-conflicts&owner=%40me&name=skills-resolve-merge-conflicts&description=Exercise:+Resolve+Merge+Conflicts&visibility=public)
Having trouble? 🤷
diff --git a/resume.md b/resume.md index 34a572a..e60d7dd 100644 --- a/resume.md +++ b/resume.md @@ -20,4 +20,4 @@ Developed and maintained various conference talks, online training, and in-perso ### Leadership -Managed multiple asynchronous teams in the development, maintenance, and release of various web applications and websites. \ No newline at end of file +Managed multiple asynchronous teams in the development, maintenance, and release of various web applications and websites.