forked from angular-schule/ngx-deploy-starter
-
-
Notifications
You must be signed in to change notification settings - Fork 15
52 lines (45 loc) · 1.62 KB
/
Copy pathpr-release-preview.yml
File metadata and controls
52 lines (45 loc) · 1.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: PR Release Preview
on:
pull_request:
types: [opened, synchronize, reopened, edited]
jobs:
release-preview:
name: Release preview
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup
- name: Validate PR title
id: commitlint
run: |
if echo "${{ github.event.pull_request.title }}" | npx --no-install commitlint > commitlint.err 2>&1; then
echo "ok=true" >> "$GITHUB_OUTPUT"
else
echo "ok=false" >> "$GITHUB_OUTPUT"
fi
- name: Generate release preview comment
id: preview
if: always()
env:
PR_TITLE: ${{ github.event.pull_request.title }}
BASE_REF: ${{ github.base_ref }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
COMMITLINT_OK: ${{ steps.commitlint.outputs.ok == 'true' && '1' || '0' }}
run: npx ts-node --transpile-only -O '{"module":"commonjs"}' tools/ci/pr-release-preview.ts
- name: Upload release preview comment
if: always() && steps.preview.outcome != 'skipped'
uses: actions/upload-artifact@v7
with:
name: release-preview-comment
path: comment.md
retention-days: 1
- name: Enforce valid PR title
if: steps.commitlint.outputs.ok != 'true'
run: |
echo "::error::PR title must follow Conventional Commits (see commitlint output in the PR comment)."
exit 1
- name: Enforce release preview succeeded
if: steps.preview.outcome == 'failure'
run: exit 1