Welcome to mirror list, hosted at ThFree Co, Russian Federation.

auto-start-ci.yml « workflows « .github - github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c7bfd56ae1732ce0ec189bf00a8f12babb494a4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Auto Start CI

on:
  schedule:
    # Runs every five minutes (fastest the scheduler can run). Five minutes is
    # optimistic, it can take longer to run.
    # To understand why `schedule` is used instead of other events, refer to
    # ./doc/guides/commit-queue.md
    - cron: "*/5 * * * *"

env:
  NODE_VERSION: lts/*

jobs:
  startCI:
    if: github.repository == 'nodejs/node'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
        with:
          persist-credentials: false

      # Install dependencies
      - name: Install Node.js
        uses: actions/setup-node@v2
        with:
          node-version: ${{ env.NODE_VERSION }}
      - name: Install node-core-utils
        run: npm install -g node-core-utils

      - name: Set variables
        run: |
          echo "REPOSITORY=$(echo ${{ github.repository }} | cut -d/ -f2)" >> $GITHUB_ENV
          echo "OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV

      # Get Pull Requests
      - name: Get Pull Requests
        uses: octokit/graphql-action@v2.x
        id: get_prs_for_ci
        with:
          query: |
            query prs($owner:String!, $repo:String!) {
              repository(owner:$owner, name:$repo) {
                pullRequests(labels: ["request-ci"], states: OPEN, last: 100) {
                  nodes {
                    number
                  }
                }
              }
            }
          owner: ${{ env.OWNER }}
          repo: ${{ env.REPOSITORY }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

      - name: Setup node-core-utils
        run: |
          ncu-config set username ${{ secrets.JENKINS_USER }}
          ncu-config set token none
          ncu-config set jenkins_token ${{ secrets.JENKINS_TOKEN }}
          ncu-config set owner ${{ env.OWNER }}
          ncu-config set repo ${{ env.REPOSITORY }}

      - name: Start CI
        run: ./tools/actions/start-ci.sh $(echo '${{ steps.get_prs_for_ci.outputs.data }}' | jq '.repository.pullRequests.nodes | map(.number) | .[]')
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}