Skip to content

Commit da443b9

Browse files
committed
build: show CI results on PR
1 parent e7864e6 commit da443b9

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/on-ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# .github/workflows/webhook.yml
2+
name: Webhook workflow
3+
4+
on:
5+
repository_dispatch:
6+
types: [ci-complete]
7+
8+
env:
9+
NODE_VERSION: lts/*
10+
11+
jobs:
12+
deploy:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Install Node.js
17+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
18+
with:
19+
node-version: ${{ env.NODE_VERSION }}
20+
21+
- name: Install @node-core/utils
22+
run: npm install -g @node-core/utils
23+
24+
- name: Setup @node-core/utils
25+
run: |
26+
ncu-config set username "$USERNAME"
27+
ncu-config set token "$GH_TOKEN"
28+
ncu-config set jenkins_token "$JENKINS_TOKEN"
29+
ncu-config set owner "$GITHUB_REPOSITORY_OWNER"
30+
ncu-config set repo "$(echo "$GITHUB_REPOSITORY" | cut -d/ -f2)"
31+
env:
32+
USERNAME: ${{ secrets.JENKINS_USER }}
33+
GH_TOKEN: ${{ secrets.GH_USER_TOKEN }}
34+
JENKINS_TOKEN: ${{ secrets.JENKINS_TOKEN }}
35+
36+
- name: Start the CI
37+
run: |
38+
curl -fsSL "https://github.com/${GITHUB_REPOSITORY}/raw/${GITHUB_SHA}/tools/actions/ci-status.sh" \
39+
| sh
40+
env:
41+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42+
GITHUB_PR_NUMBER: ${{ github.event.client_payload.pr }}
43+
JENKINS_JOB_ID: ${{ github.event.client_payload.id }}
44+
GH_REPO: ${{ github.repository }}

tools/actions/ci-status.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ncu-ci pr ${JENKINS_JOB_ID} --markdown output.md
2+
gh pr comment ${GITHUB_PR_NUMBER} --body-file output.md

0 commit comments

Comments
 (0)