Skip to content

Commit

Permalink
fixup! tools: fix `GitHub actions status when CQ is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Dec 16, 2021
1 parent 36ada64 commit 388d216
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/auto-start-ci.yml
Expand Up @@ -12,9 +12,11 @@ env:
NODE_VERSION: lts/*

jobs:
startCI:
get_prs_for_ci:
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
Expand All @@ -27,23 +29,24 @@ jobs:
--limit 100
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
startCI:
needs: get_prs_for_ci
if: ${{ needs.get_prs_for_ci.outputs.numbers != '' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
if: ${{ steps.get_prs_for_ci.outputs.numbers != '' }}
with:
persist-credentials: false

# Install dependencies
- name: Install Node.js
if: ${{ steps.get_prs_for_ci.outputs.numbers != '' }}
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install node-core-utils
if: ${{ steps.get_prs_for_ci.outputs.numbers != '' }}
run: npm install -g node-core-utils

- name: Setup node-core-utils
if: ${{ steps.get_prs_for_ci.outputs.numbers != '' }}
run: |
ncu-config set username ${{ secrets.JENKINS_USER }}
ncu-config set token none
Expand All @@ -52,7 +55,6 @@ jobs:
ncu-config set repo "$(echo ${{ github.repository }} | cut -d/ -f2)"
- name: Start the CI
if: ${{ steps.get_prs_for_ci.outputs.numbers != '' }}
run: ./tools/actions/start-ci.sh "${{ steps.get_prs_for_ci.outputs.numbers }}"
run: ./tools/actions/start-ci.sh "${{ needs.get_prs_for_ci.outputs.numbers }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 9 additions & 8 deletions .github/workflows/commit-queue.yml
Expand Up @@ -17,9 +17,11 @@ env:
NODE_VERSION: lts/*

jobs:
commitQueue:
get_mergable_pull_requests:
if: github.repository == 'nodejs/node'
runs-on: ubuntu-latest
outputs:
numbers: ${{ steps.get_mergable_pull_requests.outputs.numbers }}
steps:
- name: Get Pull Requests
id: get_mergable_pull_requests
Expand All @@ -33,8 +35,12 @@ jobs:
--limit 100
env:
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
commitQueue:
needs: get_mergable_pull_requests
runs-on: ubuntu-latest
if: ${{ needs.get_mergable_pull_requests.outputs.numbers != '' }}
steps:
- uses: actions/checkout@v2
if: ${{ steps.get_mergable_pull_requests.outputs.numbers != '' }}
with:
# Needs the whole git history for ncu to work
# See https://github.com/nodejs/node-core-utils/pull/486
Expand All @@ -47,22 +53,18 @@ jobs:

# Install dependencies
- name: Install Node.js
if: ${{ steps.get_mergable_pull_requests.outputs.numbers != '' }}
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install node-core-utils
if: ${{ steps.get_mergable_pull_requests.outputs.numbers != '' }}
run: npm install -g node-core-utils@latest

- name: Set variables
if: ${{ steps.get_mergable_pull_requests.outputs.numbers != '' }}
run: |
echo "REPOSITORY=$(echo ${{ github.repository }} | cut -d/ -f2)" >> $GITHUB_ENV
echo "OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV
- name: Configure node-core-utils
if: ${{ steps.get_mergable_pull_requests.outputs.numbers != '' }}
run: |
ncu-config set branch ${GITHUB_REF_NAME}
ncu-config set upstream origin
Expand All @@ -73,7 +75,6 @@ jobs:
ncu-config set owner "${OWNER}"
- name: Start the Commit Queue
if: ${{ steps.get_mergable_pull_requests.outputs.numbers != '' }}
run: ./tools/actions/commit-queue.sh ${{ env.OWNER }} ${{ env.REPOSITORY }} "${{ steps.get_mergable_pull_requests.outputs.numbers }}"
run: ./tools/actions/commit-queue.sh ${{ env.OWNER }} ${{ env.REPOSITORY }} "${{ needs.get_mergable_pull_requests.outputs.numbers }}"
env:
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}

0 comments on commit 388d216

Please sign in to comment.