mirror of
https://github.com/webiny/action-conventional-commits.git
synced 2024-11-23 10:21:51 +01:00
chore: initial commit
This commit is contained in:
parent
f7ae5dbbd2
commit
7916d53e96
8 changed files with 134 additions and 2 deletions
25
.gitignore
vendored
Normal file
25
.gitignore
vendored
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
.idea
|
||||||
|
.webpack
|
||||||
|
.webiny
|
||||||
|
.serverless
|
||||||
|
.env*
|
||||||
|
.npmrc
|
||||||
|
htpasswd
|
||||||
|
lerna-debug.log
|
||||||
|
npm-debug.log
|
||||||
|
node_modules
|
||||||
|
.DS_Store
|
||||||
|
coverage
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
lib/
|
||||||
|
build/
|
||||||
|
.files/
|
||||||
|
.changelog
|
||||||
|
.verdaccio
|
||||||
|
.history
|
||||||
|
*.tsbuildinfo
|
||||||
|
.cloudfnsrc.js
|
||||||
|
.cloudfns/
|
||||||
|
yarn.lock
|
12
.prettierrc.js
Normal file
12
.prettierrc.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
module.exports = {
|
||||||
|
printWidth: 100,
|
||||||
|
tabWidth: 2,
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ["*.js", "*.ts", "*.tsx"],
|
||||||
|
options: {
|
||||||
|
tabWidth: 4
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
6
CONTRIBUTING.md
Normal file
6
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
Commit all of the changes you have locally, then use the following commands to create a tag and push everything:
|
||||||
|
|
||||||
|
```
|
||||||
|
git tag -a -m "Release v1.0.19" v1.0.19
|
||||||
|
git push --follow-tags
|
||||||
|
```
|
23
README.md
23
README.md
|
@ -1,2 +1,21 @@
|
||||||
# action-conventional-commits
|
# Hello world javascript action
|
||||||
Ensures that all commits are following the conventional-commits standard.
|
|
||||||
|
This action prints "Hello World" or "Hello" + the name of a person to greet to the log.
|
||||||
|
|
||||||
|
## Inputs
|
||||||
|
|
||||||
|
### `who-to-greet`
|
||||||
|
|
||||||
|
**Required** The name of the person to greet. Default `"World"`.
|
||||||
|
|
||||||
|
## Outputs
|
||||||
|
|
||||||
|
### `time`
|
||||||
|
|
||||||
|
The time we greeted you.
|
||||||
|
|
||||||
|
## Example usage
|
||||||
|
|
||||||
|
uses: actions/hello-world-javascript-action@v1
|
||||||
|
with:
|
||||||
|
who-to-greet: 'Mona the Octocat'
|
||||||
|
|
5
action.yml
Normal file
5
action.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
name: "Conventional Commits"
|
||||||
|
description: "Ensures that all commit messages are following the conventional-commits standard."
|
||||||
|
runs:
|
||||||
|
using: node12
|
||||||
|
main: dist/main/index.js
|
38
main.ts
Normal file
38
main.ts
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
import { Contreebutors } from "contreebutors";
|
||||||
|
const { GitHub, context } = require('@actions/github');
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
const core = require("@actions/core");
|
||||||
|
const exec = require("@actions/exec");
|
||||||
|
|
||||||
|
// 1. Extract a list of users from received commits.
|
||||||
|
const token = process.env.GH_TOKEN;
|
||||||
|
|
||||||
|
const client = new GitHub(token, {});
|
||||||
|
const result = await client.repos.listPullRequestsAssociatedWithCommit({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
commit_sha: context.sha,
|
||||||
|
});
|
||||||
|
|
||||||
|
const pr = result.data.length > 0 && result.data[0];
|
||||||
|
|
||||||
|
core.setOutput('pr', pr && pr.number || '');
|
||||||
|
core.setOutput('number', pr && pr.number || '');
|
||||||
|
core.setOutput('title', pr && pr.title || '');
|
||||||
|
core.setOutput('body', pr && pr.body || '');
|
||||||
|
|
||||||
|
|
||||||
|
// 2. Add them to the list.
|
||||||
|
const contreebutors = new Contreebutors();
|
||||||
|
|
||||||
|
for (let i = 0; i < users.length; i++) {
|
||||||
|
let user = users[i];
|
||||||
|
await contreebutors.add(user);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. Commit changes done on the `contreebutors.json` and `README.md` file.
|
||||||
|
|
||||||
|
// 4. Add comment to the merged PR - notify the user that he was added to the contributors list.
|
||||||
|
|
||||||
|
})();
|
21
package.json
Normal file
21
package.json
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"name": "action-conventional-commits",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"main": "index.js",
|
||||||
|
"repository": "git@github.com:doitadrian/action-conventional-commits.git",
|
||||||
|
"author": "Adrian Smijulj <adrian1358@gmail.com>",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@actions/core": "^1.2.3",
|
||||||
|
"@actions/exec": "^1.0.3",
|
||||||
|
"@actions/github": "^2.1.1"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@zeit/ncc": "^0.22.0",
|
||||||
|
"prettier": "^2.0.2"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"build": "ncc build main.ts --out dist/main",
|
||||||
|
"watch": "ncc build main.ts --out dist/main --watch"
|
||||||
|
}
|
||||||
|
}
|
6
tsconfig.json
Normal file
6
tsconfig.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es2015",
|
||||||
|
"moduleResolution": "node"
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue