Auto Start CI #18337
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 * * * *" | |
jobs: | |
startCI: | |
if: github.repository == 'nodejs/node' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
# Install dependencies | |
- name: Install jq | |
run: sudo apt-get install jq -y | |
- name: Install Node.js | |
uses: actions/setup-node@v2-beta | |
with: | |
node-version: '12' | |
- name: Install node-core-utils | |
run: npm install -g node-core-utils | |
- name: Set variables | |
run: | | |
echo "::set-env name=REPOSITORY::$(echo ${{ github.repository }} | cut -d/ -f2)" | |
echo "::set-env name=OWNER::${{ github.repository_owner }}" | |
# Get Pull Requests | |
- name: Get Pull Requests | |
uses: octokit/[email protected] | |
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 ${{ secrets.GITHUB_TOKEN }} ${{ env.OWNER }} ${{ env.REPOSITORY }} $(echo '${{ steps.get_prs_for_ci.outputs.data }}' | jq '.repository.pullRequests.nodes | map(.number) | .[]') |