Следите за новостями GitVerse в нашем телеграм-канале

lesson-snapshot-z6GVA

64 строки · 2.1 Кб
1
name: Step 0, Welcome
2

3
# This step triggers after the learner creates a new repository from the template.
4
# This workflow updates from step 0 to step 1.
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
8
on:
9
  workflow_dispatch:
10
  push:
11
    branches:
12
      - master
13

14
# Reference: https://docs.github.com/en/actions/security-guides/automatic-token-authentication
15
permissions:
16
  # Need `contents: read` to checkout the repository.
17
  # Need `contents: write` to update the step metadata.
18
  contents: write
19

20
jobs:
21
  # Get the current step to only run the main job when the learner is on the same step.
22
  get_current_step:
23
    name: Check current step number
24
    runs-on: ubuntu-cloud-runner
25
    steps:
26
      - name: Checkout
27
        uses: actions/checkout@v4
28
      - id: get_step
29
        run: |
30
          echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT
31
    outputs:
32
      current_step: ${{ steps.get_step.outputs.current_step }}
33

34
  on_welcome:
35
    name: On welcome
36
    needs: get_current_step
37

38
    # We will only run this action when:
39
    # 1. This repository isn't the template repository.
40
    # 2. The step is currently 0.
41
    # Reference: https://docs.github.com/en/actions/learn-github-actions/contexts
42
    # Reference: https://docs.github.com/en/actions/learn-github-actions/expressions
43
    if: >-
44
      ${{ !github.event.repository.is_template
45
          && needs.get_current_step.outputs.current_step == 0 }} == true
46

47
    # We'll run Ubuntu for performance instead of Mac or Windows.
48
    runs-on: ubuntu-cloud-runner
49

50
    steps:
51
      # We'll need to check out the repository so that we can edit README.md.
52
      - name: Checkout
53
        uses: actions/checkout@v4
54
        with:
55
          fetch-depth: 0 # Let's get all the branches.
56

57
      # In README.md, switch step 0 for step 1.
58
      - name: Update to step 1
59
        uses: https://gitverse.ru/skills/action-update-step@v4
60
        with:
61
          token: ${{ secrets.GITHUB_TOKEN }}
62
          from_step: 0
63
          to_step: 1
64
          branch_name: my-first-branch
65

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.