Skip to content

Commit 36e9432

Browse files
authored
Add GitHub Actions workflow for building PR docs
1 parent 8cf6996 commit 36e9432

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/build-pr.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
name: Build static docs
3+
4+
on:
5+
push:
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
environment:
12+
name: build-pr
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
ref: ${{ github.event.pull_request.head.sha }}
19+
20+
- name: Use Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: "20.x"
24+
cache: 'npm'
25+
26+
- run: npm ci
27+
- run: npm run build --if-present
28+
29+
- name: Get Project Version from Git Tag
30+
id: get_version
31+
run: |
32+
# Use 'git describe' to find the closest tag, falling back to the commit SHA if no tag is found.
33+
# --tags includes all tags, --always ensures it always outputs something.
34+
VERSION=$(git describe --tags --always)
35+
echo "Project version is $VERSION"
36+
echo "tag=$VERSION" >> $GITHUB_OUTPUT
37+
38+
- name: SonarQube Analysis (Pull Request)
39+
uses: SonarSource/sonarqube-scan-action@v6
40+
env:
41+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
42+
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
43+
with:
44+
args: >
45+
-Dsonar.projectVersion=${{ steps.get_version.outputs.tag }}
46+
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
47+
-Dsonar.pullrequest.branch=${{ github.event.pull_request.head.ref }}
48+
-Dsonar.pullrequest.base=${{ github.event.pull_request.base.ref }}

0 commit comments

Comments
 (0)