diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..845ead8 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,25 @@ +on: + workflow_dispatch: + +jobs: + createConflict: + runs-on: ubuntu-latest + permissions: write-all + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: get file and commit change + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git pull origin main + curl -o cube.ipynb https://raw.githubusercontent.com/ttimbers/r-cube-commit-source/main/cube.ipynb + git commit -m "Here's a fix to the file!" -a + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b428501 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Tiffany A. Timbers + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..ab5c776 --- /dev/null +++ b/README.md @@ -0,0 +1,17 @@ +# r-cube-notebook + +Pratice GitHub repository for practicing resolving merge conflicts in Jupyter notebooks. + +## Instructions + +## Instructions + +1. Click the green "**Use this template**" button in this repository to obtain a copy of it for yourself (do not fork it). + +2. Clone this repository to your computer. + +3. Click on the Actions tab, and then click on the workflow .github/workflows/main.yml. You then should see a “Run workflow” button with a drop down menu, from that menu select “Run workflow” (this will trigger GitHub Actions to create a commit in your remote repository). + +4. Fix the second line in the code cell in `cube.ipynb` so that it calculates the cube, not the square (e.g., change `x^2` to `x^3`). Commit your changes to version control via Git and push your changes to GitHub. + +5. Resolve the merge conflict them so that you can see your changes on GitHub. diff --git a/cube.ipynb b/cube.ipynb new file mode 100644 index 0000000..a4953a0 --- /dev/null +++ b/cube.ipynb @@ -0,0 +1,72 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "ab324497-87ef-4d8e-8af5-7e93e22de3dd", + "metadata": {}, + "source": [ + "## Calculate a cube of a number\n", + "\n", + "Function named `cube` that calculates a cube of a number:" + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "edefa052-6e8c-48cd-9367-ab89cde8c6e6", + "metadata": {}, + "outputs": [], + "source": [ + "cube <- function(x) {\n", + " x^2\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "bb82b9b2-06ca-4d5c-88de-bbab1a249244", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "4" + ], + "text/latex": [ + "4" + ], + "text/markdown": [ + "4" + ], + "text/plain": [ + "[1] 4" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "cube(2)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "R", + "language": "R", + "name": "ir" + }, + "language_info": { + "codemirror_mode": "r", + "file_extension": ".r", + "mimetype": "text/x-r-source", + "name": "R", + "pygments_lexer": "r", + "version": "4.1.2" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +}