|
| 1 | +name: Step 3, Open a pull request |
| 2 | + |
| 3 | +# This step listens for the learner to open a pull request with branch `my-first-branch` |
| 4 | +# This step sets `STEP` to 4 |
| 5 | +# This step closes <details id=3> and opens <details id=4> |
| 6 | + |
| 7 | +# This will run every time we create a branch or tag |
| 8 | +# Reference https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows |
| 9 | +on: |
| 10 | + workflow_dispatch: |
| 11 | + pull_request: |
| 12 | + types: |
| 13 | + - opened |
| 14 | + - reopened |
| 15 | + |
| 16 | +jobs: |
| 17 | + update_to_step_4: |
| 18 | + name: On open a pull request |
| 19 | + |
| 20 | + # We will only run this action when: |
| 21 | + # 1. This repository isn't the template repository |
| 22 | + # 2. The STEP is currently '3' (see lower `if`s) |
| 23 | + # 3. The head branch name is `my-first-branch` |
| 24 | + # Reference https://docs.github.com/en/actions/learn-github-actions/contexts |
| 25 | + # Reference https://docs.github.com/en/actions/learn-github-actions/expressions |
| 26 | + if: ${{ github.repository_owner != 'githublearn' && github.head_ref == 'my-first-branch' }} |
| 27 | + |
| 28 | + # We'll run Ubuntu for performance instead of Mac or Windows |
| 29 | + runs-on: ubuntu-latest |
| 30 | + |
| 31 | + steps: |
| 32 | + # We'll need to check out the repository so that we can edit the README |
| 33 | + - name: Checkout |
| 34 | + uses: actions/checkout@v2 |
| 35 | + with: |
| 36 | + fetch-depth: 0 # Let's get all the branches |
| 37 | + ref: my-first-branch # Important, as normally `pull_request` event won't grab other branches |
| 38 | + |
| 39 | + # Update README to close <details id=3> |
| 40 | + # and open <details id=4> |
| 41 | + # and set STEP to '4' |
| 42 | + - name: Update to step 4 |
| 43 | + run: ./.github/script/update-for-step.sh |
| 44 | + env: |
| 45 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + FROM_STEP: 3 |
| 47 | + TO_STEP: 4 |
| 48 | + BRANCH_NAME: my-first-branch |
0 commit comments