|
| 1 | +name: Auto Start CI |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + # Runs every five minutes (fastest the scheduler can run). Five minutes is |
| 6 | + # optimistic, it can take longer to run. |
| 7 | + # To understand why `schedule` is used instead of other events, refer to |
| 8 | + # ./doc/contributing/commit-queue.md |
| 9 | + - cron: '*/5 * * * *' |
| 10 | + |
| 11 | +concurrency: ${{ github.workflow }} |
| 12 | + |
| 13 | +env: |
| 14 | + NODE_VERSION: lts/* |
| 15 | + |
| 16 | +permissions: |
| 17 | + contents: read |
| 18 | + |
| 19 | +jobs: |
| 20 | + get-prs-for-ci: |
| 21 | + permissions: |
| 22 | + pull-requests: read |
| 23 | + if: github.repository == 'nodejs/node' |
| 24 | + runs-on: ubuntu-latest |
| 25 | + outputs: |
| 26 | + numbers: ${{ steps.get_prs_for_ci.outputs.numbers }} |
| 27 | + steps: |
| 28 | + - name: Get Pull Requests |
| 29 | + id: get_prs_for_ci |
| 30 | + run: > |
| 31 | + gh pr list \ |
| 32 | + --repo ${{ github.repository }} \ |
| 33 | + --label 'resume-ci' \ |
| 34 | + --json 'number' \ |
| 35 | + -t '::set-output name=numbers::{{ range . }}{{ .number }} {{ end }}' \ |
| 36 | + --limit 100 |
| 37 | + env: |
| 38 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 39 | + start-ci: |
| 40 | + permissions: |
| 41 | + contents: read |
| 42 | + pull-requests: write |
| 43 | + needs: get-prs-for-ci |
| 44 | + if: needs.get-prs-for-ci.outputs.numbers != '' |
| 45 | + runs-on: ubuntu-latest |
| 46 | + steps: |
| 47 | + - uses: actions/checkout@v3 |
| 48 | + with: |
| 49 | + persist-credentials: false |
| 50 | + |
| 51 | + - name: Install Node.js |
| 52 | + uses: actions/setup-node@v3 |
| 53 | + with: |
| 54 | + node-version: ${{ env.NODE_VERSION }} |
| 55 | + |
| 56 | + - name: Install node-core-utils |
| 57 | + run: npm install -g node-core-utils |
| 58 | + |
| 59 | + - name: Setup node-core-utils |
| 60 | + run: | |
| 61 | + ncu-config set username ${{ secrets.JENKINS_USER }} |
| 62 | + ncu-config set token none |
| 63 | + ncu-config set jenkins_token ${{ secrets.JENKINS_TOKEN }} |
| 64 | + ncu-config set owner "${{ github.repository_owner }}" |
| 65 | + ncu-config set repo "$(echo ${{ github.repository }} | cut -d/ -f2)" |
| 66 | +
|
| 67 | + - name: Resume the CI Runs |
| 68 | + run: ./tools/actions/resume-ci.sh ${{ needs.get-prs-for-ci.outputs.numbers }} |
| 69 | + env: |
| 70 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments