Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 6 additions & 33 deletions .github/workflows/auto-start-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,18 @@
name: Auto Start CI

on:
schedule:
# `schedule` event is used instead of `pull_request` because when a
# `pull_requesst` event is triggered on a PR from a fork, GITHUB_TOKEN will
# be read-only, and the Action won't have access to any other repository
# secrets, which it needs to access Jenkins API. Runs every five minutes
# (fastest the scheduler can run). Five minutes is optimistic, it can take
# longer to run.
- cron: "*/5 * * * *"
pull_request_target:
types:
- labeled

jobs:
startCI:
if: github.repository == 'nodejs/node'
runs-on: ubuntu-latest
if: github.event.label.name == 'request-ci'
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v2

# Install dependencies
- name: Install jq
run: sudo apt-get install jq -y
- name: Install Node.js
uses: actions/setup-node@v2-beta
with:
Expand All @@ -33,26 +26,6 @@ jobs:
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 }}
Expand All @@ -62,4 +35,4 @@ jobs:
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) | .[]')
run: ./tools/actions/start-ci.sh ${{ secrets.GITHUB_TOKEN }} ${{ env.OWNER }} ${{ env.REPOSITORY }} ${{ github.event.number }}