Elffuss BraidHub

kikocis/lancedb public

main · 2.8 KiBRawPermalink
1name: PR Checks
2
3on:
4 pull_request_target:
5 types: [opened, edited, synchronize, reopened]
6
7concurrency:
8 group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
9 cancel-in-progress: true
10
11jobs:
12 labeler:
13 permissions:
14 pull-requests: write
15 name: Label PR
16 runs-on: ubuntu-latest
17 steps:
18 - uses: srvaroa/labeler@master
19 env:
20 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 commitlint:
22 permissions:
23 pull-requests: write
24 name: Verify PR title / description conforms to semantic-release
25 runs-on: ubuntu-latest
26 steps:
27 - uses: actions/setup-node@v3
28 with:
29 node-version: "18"
30 # These rules are disabled because Github will always ensure there
31 # is a blank line between the title and the body and Github will
32 # word wrap the description field to ensure a reasonable max line
33 # length.
34 - run: npm install @commitlint/config-conventional
35 - run: >
36 echo 'module.exports = {
37 "rules": {
38 "body-max-line-length": [0, "always", Infinity],
39 "footer-max-line-length": [0, "always", Infinity],
40 "body-leading-blank": [0, "always"]
41 }
42 }' > .commitlintrc.js
43 - run: npx commitlint --extends @commitlint/config-conventional --verbose <<< $COMMIT_MSG
44 env:
45 COMMIT_MSG: >
46 ${{ github.event.pull_request.title }}
47
48 ${{ github.event.pull_request.body }}
49 - if: failure()
50 uses: actions/github-script@v6
51 with:
52 script: |
53 const message = `**ACTION NEEDED**
54
55 Lance follows the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) for release automation.
56
57 The PR title and description are used as the merge commit message.\
58 Please update your PR title and description to match the specification.
59
60 For details on the error please inspect the "PR Title Check" action.
61 `
62 // Get list of current comments
63 const comments = await github.paginate(github.rest.issues.listComments, {
64 owner: context.repo.owner,
65 repo: context.repo.repo,
66 issue_number: context.issue.number
67 });
68 // Check if this job already commented
69 for (const comment of comments) {
70 if (comment.body === message) {
71 return // Already commented
72 }
73 }
74 // Post the comment about Conventional Commits
75 github.rest.issues.createComment({
76 owner: context.repo.owner,
77 repo: context.repo.repo,
78 issue_number: context.issue.number,
79 body: message
80 })
81 core.setFailed(message)