diff --git a/.github/workflows/auto-start-ci.yml b/.github/workflows/auto-start-ci.yml index bfd6c9c23fae19..0b846d164f61fd 100644 --- a/.github/workflows/auto-start-ci.yml +++ b/.github/workflows/auto-start-ci.yml @@ -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 @@ -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 @@ -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 }} diff --git a/.github/workflows/commit-queue.yml b/.github/workflows/commit-queue.yml index 452ca021ed422a..441c1e8b1d853b 100644 --- a/.github/workflows/commit-queue.yml +++ b/.github/workflows/commit-queue.yml @@ -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 @@ -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 @@ -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 @@ -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 }}