Skip to content
Merged
Show file tree
Hide file tree
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
tools: fix GitHub Actions status when CQ is empty
  • Loading branch information
aduh95 committed Dec 17, 2021
commit 2fb7aaf7f16e4a2c0b8c5f142f27198502f1d3d8
24 changes: 20 additions & 4 deletions .github/workflows/auto-start-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,27 @@ 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
run: >
gh pr list \
--repo ${{ github.repository }} \
--label 'request-ci' \
--json 'number' \
-t '::set-output name=numbers::{{ range . }}{{ .number }} {{ end }}' \
--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
with:
Expand All @@ -37,8 +55,6 @@ jobs:
ncu-config set repo "$(echo ${{ github.repository }} | cut -d/ -f2)"

- name: Start the CI
run: |
PRs=$(gh pr list --label 'request-ci' --json number --jq 'map(.number) | .[]' --limit 100)
./tools/actions/start-ci.sh "$PRs"
run: ./tools/actions/start-ci.sh "${{ needs.get_prs_for_ci.outputs.numbers }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32 changes: 22 additions & 10 deletions .github/workflows/commit-queue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,28 @@ env:
NODE_VERSION: lts/*

jobs:
commitQueue:
get_mergeable_prs:
if: github.repository == 'nodejs/node'
runs-on: ubuntu-latest
outputs:
numbers: ${{ steps.get_mergeable_prs.outputs.numbers }}
steps:
- name: Get Pull Requests
id: get_mergeable_prs
run: >
gh pr list \
--repo ${{ github.repository }} \
--base ${{ github.ref_name }} \
--label 'commit-queue' \
--json 'number' \
-t '::set-output name=numbers::{{ range . }}{{ .number }} {{ end }}' \
--limit 100
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
commitQueue:
needs: get_mergeable_prs
if: needs.get_mergeable_prs.outputs.numbers != ''
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -44,11 +63,10 @@ jobs:
run: |
echo "REPOSITORY=$(echo ${{ github.repository }} | cut -d/ -f2)" >> $GITHUB_ENV
echo "OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV
echo "DEFAULT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV

- name: Configure node-core-utils
run: |
ncu-config set branch ${DEFAULT_BRANCH}
ncu-config set branch ${GITHUB_REF_NAME}
ncu-config set upstream origin
ncu-config set username "${{ secrets.GH_USER_NAME }}"
ncu-config set token "${{ secrets.GH_USER_TOKEN }}"
Expand All @@ -57,12 +75,6 @@ jobs:
ncu-config set owner "${OWNER}"

- name: Start the Commit Queue
run: |
PRs=$(gh pr list \
--base ${{ env.DEFAULT_BRANCH }} \
--label 'commit-queue' \
--json number --jq 'map(.number) | .[]' \
--limit 100)
./tools/actions/commit-queue.sh ${{ env.OWNER }} ${{ env.REPOSITORY }} "$PRs"
run: ./tools/actions/commit-queue.sh ${{ env.OWNER }} ${{ env.REPOSITORY }} "${{ needs.get_mergeable_prs.outputs.numbers }}"
env:
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}