Auto Start CI #196738
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/contributing/commit-queue.md | |
- cron: '*/5 * * * *' | |
concurrency: ${{ github.workflow }} | |
env: | |
NODE_VERSION: lts/* | |
permissions: | |
contents: read | |
jobs: | |
get-prs-for-ci: | |
permissions: | |
pull-requests: read | |
if: github.repository == 'nodejs/node' | |
runs-on: ubuntu-latest | |
outputs: | |
numbers: ${{ steps.get_prs_for_ci.outputs.numbers }} | |
steps: | |
- name: Get Pull Requests | |
id: get_prs_for_ci | |
run: > | |
numbers=$(gh pr list \ | |
--repo ${{ github.repository }} \ | |
--label 'request-ci' \ | |
--json 'number' \ | |
-t '{{ range . }}{{ .number }} {{ end }}' \ | |
--limit 5) | |
echo "numbers=$numbers" >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
start-ci: | |
permissions: | |
contents: read | |
pull-requests: write | |
needs: get-prs-for-ci | |
if: needs.get-prs-for-ci.outputs.numbers != '' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
with: | |
persist-credentials: false | |
- name: Install Node.js | |
uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Install @node-core/utils | |
run: npm install -g @node-core/utils | |
- name: Setup @node-core/utils | |
run: | | |
ncu-config set username "$USERNAME" | |
ncu-config set token "$GH_TOKEN" | |
ncu-config set jenkins_token "$JENKINS_TOKEN" | |
ncu-config set owner "${{ github.repository_owner }}" | |
ncu-config set repo "$(echo ${{ github.repository }} | cut -d/ -f2)" | |
env: | |
USERNAME: ${{ secrets.JENKINS_USER }} | |
GH_TOKEN: ${{ secrets.GH_USER_TOKEN }} | |
JENKINS_TOKEN: ${{ secrets.JENKINS_TOKEN }} | |
- name: Start the CI | |
run: ./tools/actions/start-ci.sh ${{ needs.get-prs-for-ci.outputs.numbers }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |