Skip to content

Commit b95be69

Browse files
committed
✨ feat(commit-comment): Done
0 parents  commit b95be69

25 files changed

+8229
-0
lines changed

.changeset/config.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"linked": [],
6+
"access": "restricted",
7+
"baseBranch": "main",
8+
"updateInternalDependencies": "patch",
9+
"ignore": []
10+
}

.eslintrc.js

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['@modern-js'],
4+
};

.github/workflows/deploy.yml

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: deploy
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
pull_request_target:
7+
push:
8+
branches:
9+
- main
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
- uses: pnpm/action-setup@v2
16+
with:
17+
version: 9.0.4
18+
- uses: actions/setup-node@v3
19+
with:
20+
node-version: 18.12.0
21+
cache: pnpm
22+
- name: Get pnpm store directory
23+
run: |
24+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
25+
- name: Setup pnpm cache
26+
uses: actions/cache@v4
27+
with:
28+
path: ${{ env.STORE_PATH }}
29+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
30+
restore-keys: |
31+
${{ runner.os }}-pnpm-store-
32+
- name: Install
33+
run: |
34+
pnpm install
35+
pnpm build
36+
- uses: ./
37+
id: commit-comment
38+
with:
39+
token: ${{ secrets.GITHUB_TOKEN }}
40+
body: |
41+
Website preview for commit ${GITHUB_SHA} at ${GITHUB_RUN_ATTEMPT}
42+
- [Source code](https://github.com/dext7r/commit-comment)

.github/workflows/test.yml

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: test
2+
on:
3+
workflow_dispatch:
4+
5+
jobs:
6+
deploy:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v2
10+
with:
11+
ref: main
12+
repository: dext7r/commit-comment
13+
- uses: pnpm/action-setup@v2
14+
with:
15+
version: 9.0.4
16+
- uses: actions/setup-node@v3
17+
with:
18+
node-version: 18.12.0
19+
cache: pnpm
20+
- name: Get pnpm store directory
21+
run: |
22+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
23+
- name: Setup pnpm cache
24+
uses: actions/cache@v4
25+
with:
26+
path: ${{ env.STORE_PATH }}
27+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
28+
restore-keys: |
29+
${{ runner.os }}-pnpm-store-
30+
- name: Install
31+
run: |
32+
pnpm install
33+
pnpm build
34+
- name: Commit Comment
35+
uses: ./
36+
with:
37+
token: ${{ secrets.GITHUB_TOKEN }}
38+
body: 'This is a test comment.'

.gitignore

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
.DS_Store
2+
3+
.pnp
4+
.pnp.js
5+
.env.local
6+
.env.*.local
7+
.history
8+
*.log*
9+
10+
node_modules/
11+
.yarn-integrity
12+
.pnpm-store/
13+
*.tsbuildinfo
14+
.eslintcache
15+
.changeset/pre.json
16+
17+
coverage/
18+
release/
19+
output/
20+
output_resource/
21+
log/
22+
23+
.vscode/**/*
24+
!.vscode/settings.json
25+
!.vscode/extensions.json
26+
.idea/
27+
28+
**/*/typings/auto-generated
29+
30+
modern.config.local.*

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx --no-install lint-staged

.npmignore

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.DS_Store
2+
3+
.pnp
4+
.pnp.js
5+
.env.local
6+
.env.*.local
7+
.history
8+
*.log*
9+
10+
node_modules/
11+
.yarn-integrity
12+
*.tsbuildinfo
13+
.eslintcache
14+
15+
coverage/
16+
release/
17+
output/
18+
output_resource/
19+
tests/
20+
21+
.vscode/**/*
22+
!.vscode/settings.json
23+
!.vscode/extensions.json
24+
.idea/
25+
26+
src/
27+
28+
modern.config.*
29+
jest.config.js
30+
.eslintrc.js
31+
.eslintrc
32+
tsconfig.json
33+
CHANGELOG.md
34+
35+
**/*/api/typings/auto-generated

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
strict-peer-dependencies=false

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
lts/hydrogen

.prettierrc

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"singleQuote": true,
3+
"trailingComma": "all",
4+
"arrowParens": "avoid"
5+
}

.vscode/extensions.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"recommendations": [
3+
"styled-components.vscode-styled-components",
4+
"EditorConfig.editorconfig",
5+
"dbaeumer.vscode-eslint",
6+
"esbenp.prettier-vscode",
7+
"streetsidesoftware.code-spell-checker",
8+
"codezombiech.gitignore",
9+
"aaron-bond.better-comments",
10+
"jasonnutter.search-node-modules",
11+
"jock.svg",
12+
"mikestead.dotenv",
13+
"vscode-icons-team.vscode-icons"
14+
]
15+
}

.vscode/settings.json

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"files.associations": {
3+
".code-workspace": "jsonc",
4+
".eslintrc": "jsonc",
5+
".eslintrc*.json": "jsonc",
6+
".stylelintrc": "jsonc",
7+
"stylelintrc": "jsonc",
8+
"README": "markdown"
9+
},
10+
"search.useIgnoreFiles": true,
11+
"search.exclude": {
12+
"**/dist": true,
13+
"**/*.log": true,
14+
"**/*.pid": true,
15+
"**/.git": true,
16+
"**/node_modules": true
17+
},
18+
//
19+
"editor.rulers": [80, 120],
20+
"files.eol": "\n",
21+
"files.trimTrailingWhitespace": true,
22+
"files.insertFinalNewline": true,
23+
//
24+
"cSpell.diagnosticLevel": "Hint",
25+
"eslint.run": "onType",
26+
"eslint.probe": [
27+
"javascript",
28+
"javascriptreact",
29+
"typescript",
30+
"typescriptreact",
31+
"vue"
32+
],
33+
"eslint.format.enable": true,
34+
"eslint.lintTask.enable": true,
35+
"javascript.validate.enable": false,
36+
"typescript.validate.enable": true,
37+
"css.validate": false,
38+
"scss.validate": false,
39+
"less.validate": false,
40+
"[css]": {
41+
"editor.formatOnType": true,
42+
"editor.formatOnPaste": true,
43+
"editor.formatOnSave": true
44+
},
45+
"[scss]": {
46+
"editor.formatOnType": true,
47+
"editor.formatOnPaste": true,
48+
"editor.formatOnSave": true
49+
},
50+
"[less]": {
51+
"editor.formatOnType": true,
52+
"editor.formatOnPaste": true,
53+
"editor.formatOnSave": true
54+
},
55+
"editor.codeActionsOnSave": {
56+
"source.fixAll.eslint": "explicit"
57+
},
58+
"editor.defaultFormatter": "esbenp.prettier-vscode",
59+
"javascript.format.enable": false,
60+
"typescript.format.enable": false,
61+
//
62+
"json.format.enable": false,
63+
"[json]": {
64+
"editor.tabSize": 2,
65+
"editor.formatOnType": true,
66+
"editor.formatOnPaste": true,
67+
"editor.formatOnSave": true
68+
},
69+
"[jsonc]": {
70+
"editor.tabSize": 2,
71+
"editor.formatOnType": true,
72+
"editor.formatOnPaste": true,
73+
"editor.formatOnSave": true
74+
},
75+
"emmet.triggerExpansionOnTab": true,
76+
"typescript.tsdk": "node_modules/typescript/lib"
77+
}

LICENSE

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Copyright (c) 2020 @h7ml
2+
3+
Permission is hereby granted, free of charge, to any person obtaining
4+
a copy of this software and associated documentation files (the
5+
"Software"), to deal in the Software without restriction, including
6+
without limitation the rights to use, copy, modify, merge, publish,
7+
distribute, sublicense, and/or sell copies of the Software, and to
8+
permit persons to whom the Software is furnished to do so, subject to
9+
the following conditions:
10+
11+
The above copyright notice and this permission notice shall be
12+
included in all copies or substantial portions of the Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
![deploy](https://github.com/dext7r/commit-comment/actions/workflows/deploy.yml/badge.svg)
2+
![stars](https://badgen.net/github/stars/dext7r/commit-comment)
3+
![forks](https://badgen.net/github/forks/dext7r/commit-comment)
4+
![HitCount](http://hits.dwyl.com/dext7r/commit-comment.svg)
5+
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=dext7r_commit-comment&metric=alert_status)](https://sonarcloud.io/dashboard?id=dext7r_commit-comment)
6+
[![Technical Debt](https://sonarcloud.io/api/project_badges/quality_gate?project=dext7r_commit-comment)](https://sonarcloud.io/dashboard?id=dext7r_commit-comment)
7+
[![Bugs](https://sonarcloud.io/images/project_badges/sonarcloud-white.svg)](https://sonarcloud.io/dashboard?id=dext7r_commit-comment)
8+
9+
# Commit Comment GitHub Action
10+
11+
This GitHub Action allows you to automatically create a commit comment on a pull request.
12+
13+
## Usage
14+
15+
1. Add a step in your workflow YAML file to use this action:
16+
17+
```yaml
18+
- name: Commit Comment
19+
uses: dext7r/commit-comment@main
20+
with:
21+
token: ${{ secrets.GITHUB_TOKEN }}
22+
body: 'This is a test comment.'
23+
```
24+
25+
2. Configure the `token` input with a secret GitHub API token with the necessary permissions.
26+
27+
3. Specify the `body` input with the content of the comment you want to create.
28+
29+
## Inputs
30+
31+
- `token` (required): Secret GitHub API token to use for making API requests.
32+
- `body` (required): Comment content.
33+
34+
## Outputs
35+
36+
- `comment_id`: The ID of the comment that was created.
37+
38+
## Example
39+
40+
```yaml
41+
name: Create Comment
42+
on:
43+
pull_request:
44+
types: [opened]
45+
46+
jobs:
47+
comment:
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
- name: Commit Comment
52+
uses: dext7r/commit-comment@main
53+
with:
54+
token: ${{ secrets.GITHUB_TOKEN }}
55+
body: 'Hello from GitHub Action!'
56+
```
57+
58+
## Versioning
59+
60+
This action follows semantic versioning. See [releases](https://github.com/h7ml/commit-comment/releases) for more information about each version.
61+
62+
## License
63+
64+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

action.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: 'commit-comment-action'
2+
description: 'A GitHub Action to commit comment'
3+
author: 'h7ml <[email protected]>'
4+
5+
branding:
6+
icon: 'message-circle'
7+
color: 'green'
8+
version: 'v1.0.0'
9+
author: 'h7ml'
10+
11+
inputs:
12+
token:
13+
description: Secret GitHub API token to use for making API requests.
14+
default: ${{ github.token }}
15+
required: true
16+
body:
17+
description: Comment content.
18+
required: true
19+
20+
outputs:
21+
comment_id:
22+
description: The ID of the comment that was created.
23+
24+
runs:
25+
using: 'node20'
26+
main: './dist/lib/index.js'

0 commit comments

Comments
 (0)