Skip to content

docs: datetime functions #7398

docs: datetime functions

docs: datetime functions #7398

Workflow file for this run

name: "PR Assistant"
on:
pull_request_target:
types:
- opened
- reopened
- synchronize
- edited
- ready_for_review
- converted_to_draft
merge_group:
permissions:
pull-requests: write
contents: read
jobs:
title:
runs-on: ubuntu-latest
steps:
- name: Check PR title if not sematic
uses: actions/github-script@v6
id: check
with:
script: |
if (!context.payload.pull_request) {
core.info('PR payload is null');
core.setOutput('title', 'ignore');
return;
}
const title = context.payload.pull_request.title;
const regex = /^(rfc|feat|fix|refactor|ci|docs|chore)(\([a-z0-9-]+\))?:/;
const m = title.match(regex);
if (!m) {
core.error('PR title is not semantic');
core.setOutput('title', 'not-semantic');
return;
}
const prType = m[1];
const prScope = m[2];
const prSummary = title.substring(m[0].length);
let label = '';
switch (prType) {
case 'rfc':
label = 'pr-rfc';
break;
case 'feat':
label = 'pr-feature';
break;
case 'fix':
label = 'pr-bugfix';
break;
case 'refactor':
label = 'pr-refactor';
break;
case 'ci':
label = 'pr-build';
break;
case 'docs':
label = 'pr-doc';
break;
case 'chore':
label = 'pr-chore';
break;
}
const labels = await github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: [label],
});
core.setOutput('title', 'semantic');
- name: Delete Comment
if: steps.check.outputs.title == 'semantic'
uses: everpcpc/comment-on-pr-action@v1
with:
token: ${{ github.token }}
identifier: 'pr-assistant-title'
delete: true
- name: Comment on PR
if: steps.check.outputs.title == 'not-semantic'
uses: everpcpc/comment-on-pr-action@v1
with:
token: ${{ github.token }}
identifier: 'pr-assistant-title'
body: |
This pull request's title is not fulfill the requirements. @${{ github.event.pull_request.user.login }} please update it 🙏.
Valid format:
```
fix(query): fix group by string bug
^ ^---------------------^
| |
| +-> Summary in present tense.
|
+-------> Type: rfc, feat, fix, refactor, ci, docs, chore
```
Valid types:
- `rfc`: this PR proposes a new RFC
- `feat`: this PR introduces a new feature to the codebase
- `fix`: this PR patches a bug in codebase
- `refactor`: this PR changes the code base without new features or bugfix
- `ci`: this PR changes build/testing/ci steps
- `docs`: this PR changes the documents or websites
- `chore`: this PR only has small changes that no need to record
cla:
runs-on: ubuntu-latest
steps:
- name: Check CLA if not signed
uses: actions/github-script@v6
id: check
with:
script: |
if (!context.payload.pull_request) {
core.info('PR payload is null');
core.setOutput('cla', 'ignore');
return;
}
const body = context.payload.pull_request.body;
const regex = /I hereby agree to the terms of the CLA available at: https:\/\/databend\.rs\/dev\/policies\/cla\//;
if (!regex.test(body)) {
core.error('CLA is not signed');
core.setOutput('cla', 'not-signed');
} else {
core.setOutput('cla', 'signed');
}
- name: Delete Comment
if: steps.check.outputs.cla == 'signed'
uses: everpcpc/comment-on-pr-action@v1
with:
token: ${{ github.token }}
identifier: 'pr-assistant-cla'
delete: true
- name: Comment on PR
if: steps.check.outputs.cla == 'not-signed'
uses: everpcpc/comment-on-pr-action@v1
with:
token: ${{ github.token }}
identifier: 'pr-assistant-cla'
body: |
Pull request description must contain [CLA](https://databend.rs/doc/contributing/good-pr) like the following:
```
I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/
## Summary
Summary about this PR
- Close #issue
```