mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 10:15:07 +08:00
build: use gh cli in workflows file
PR-URL: https://github.com/nodejs/node/pull/40985 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
This commit is contained in:
1 parent
ea977fca14
commit
f404cd5ce2
3 files changed
+17
-58
No files matched your search
@@ -28,40 +28,17 @@ jobs:
|
||||
- name: Install node-core-utils
|
||||
run: npm install -g node-core-utils
|
||||
|
||||
- name: Set variables
|
||||
run: |
|
||||
echo "REPOSITORY=$(echo ${{ github.repository }} | cut -d/ -f2)" >> $GITHUB_ENV
|
||||
echo "OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV
|
||||
|
||||
# Get Pull Requests
|
||||
- name: Get Pull Requests
|
||||
uses: octokit/graphql-action@v2.x
|
||||
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 }}
|
||||
ncu-config set token none
|
||||
ncu-config set jenkins_token ${{ secrets.JENKINS_TOKEN }}
|
||||
ncu-config set owner ${{ env.OWNER }}
|
||||
ncu-config set repo ${{ env.REPOSITORY }}
|
||||
ncu-config set owner "${{ github.repository_owner }}"
|
||||
ncu-config set repo "$(echo ${{ github.repository }} | cut -d/ -f2)"
|
||||
|
||||
- name: Start CI
|
||||
run: ./tools/actions/start-ci.sh $(echo '${{ steps.get_prs_for_ci.outputs.data }}' | jq '.repository.pullRequests.nodes | map(.number) | .[]')
|
||||
- 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"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -12,12 +12,9 @@ jobs:
|
||||
steps:
|
||||
- name: Post stalled comment
|
||||
env:
|
||||
COMMENTS_URL: ${{ github.event.issue.comments_url || github.event.pull_request.comments_url }}
|
||||
run: |
|
||||
curl -X POST $COMMENTS_URL \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
--data '{ "body": "This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open." }'
|
||||
NUMBER: ${{ github.event.issue.number || github.event.pull_request.number }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: gh pr comment "$NUMBER" --repo ${{ github.repository }} --body "This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open."
|
||||
|
||||
fastTrack:
|
||||
if: github.repository == 'nodejs/node' && github.event_name == 'pull_request_target' && github.event.label.name == 'fast-track'
|
||||
|
||||
@@ -46,27 +46,6 @@ jobs:
|
||||
echo "OWNER=${{ github.repository_owner }}" >> $GITHUB_ENV
|
||||
echo "DEFAULT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
||||
|
||||
- name: Get Pull Requests
|
||||
uses: octokit/graphql-action@v2.x
|
||||
id: get_mergable_pull_requests
|
||||
with:
|
||||
query: |
|
||||
query release($owner:String!,$repo:String!, $base_ref:String!) {
|
||||
repository(owner:$owner, name:$repo) {
|
||||
pullRequests(baseRefName: $base_ref, labels: ["commit-queue"], states: OPEN, last: 100) {
|
||||
nodes {
|
||||
number
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
owner: ${{ env.OWNER }}
|
||||
repo: ${{ env.REPOSITORY }}
|
||||
# Commit queue is only enabled for the default branch on the repository
|
||||
base_ref: ${{ env.DEFAULT_BRANCH }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Configure node-core-utils
|
||||
run: |
|
||||
ncu-config set branch ${DEFAULT_BRANCH}
|
||||
@@ -77,7 +56,13 @@ jobs:
|
||||
ncu-config set repo "${REPOSITORY}"
|
||||
ncu-config set owner "${OWNER}"
|
||||
|
||||
- name: Start the commit queue
|
||||
run: ./tools/actions/commit-queue.sh ${OWNER} ${REPOSITORY} $(echo '${{ steps.get_mergable_pull_requests.outputs.data }}' | jq '.repository.pullRequests.nodes | map(.number) | .[]')
|
||||
- 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"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
|
||||
Reference in new issue
Block a user