Lesson-babaska
64 строки · 2.2 Кб
1name: Step 4, Merge your pull request2
3# This step listens for the learner to merge a pull request with branch `my-first-branch`.
4# This workflow updates from step 4 to step X.
5
6# This will run every time we create push a commit to `master`.
7# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows
8on:9workflow_dispatch:10push:11branches:12- master13
14# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
15permissions:16# Need `contents: read` to checkout the repository.17# Need `contents: write` to update the step metadata.18contents: write19
20jobs:21# Get the current step to only run the main job when the learner is on the same step.22get_current_step:23name: Check current step number24runs-on: ubuntu-cloud-runner25steps:26- name: Checkout27uses: actions/checkout@v428- id: get_step29run: |30echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
31outputs:32current_step: ${{ steps.get_step.outputs.current_step }}33
34on_merge_your_pull_request:35name: On merge your pull request36needs: get_current_step37
38# We will only run this action when:39# 1. This repository isn't the template repository.40# 2. The step is currently 4.41# Reference: https://docs.github.com/en/actions/learn-github-actions/contexts42# Reference: https://docs.github.com/en/actions/learn-github-actions/expressions43if: >-44${{ !github.event.repository.is_template45&& needs.get_current_step.outputs.current_step == 4 }} == true46
47# We'll run Ubuntu for performance instead of Mac or Windows.48runs-on: ubuntu-cloud-runner49
50steps:51# We'll need to check out the repository so that we can edit the README.52- name: Checkout53uses: actions/checkout@v454with:55fetch-depth: 0 # Let's get all the branches.56
57# In README.md, switch step 4 for step X.58- name: Update to step X59uses: https://gitverse.ru/skills/action-update-step@v460with:61token: ${{ secrets.GITHUB_TOKEN }}62from_step: 463to_step: X64branch_name: my-first-branch65