Skip to content

Commit

Permalink
feat: action doc action (#1)
Browse files Browse the repository at this point in the history
* feat: action doc action

* chore(ci): Updating dist
  • Loading branch information
npalm authored Feb 21, 2021
1 parent 8c36dc5 commit 7ce1d1a
Show file tree
Hide file tree
Showing 23 changed files with 21,294 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
dist/
lib/
node_modules/
jest.config.js
52 changes: 52 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"plugins": ["jest", "@typescript-eslint"],
"extends": ["plugin:github/recommended"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 9,
"sourceType": "module",
"project": "./tsconfig.json"
},
"rules": {
"eslint-comments/no-use": "off",
"import/no-namespace": "off",
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/explicit-member-accessibility": ["error", {"accessibility": "no-public"}],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/array-type": "error",
"@typescript-eslint/await-thenable": "error",
"@typescript-eslint/ban-ts-comment": "error",
"camelcase": "off",
"@typescript-eslint/consistent-type-assertions": "error",
"@typescript-eslint/explicit-function-return-type": ["error", {"allowExpressions": true}],
"@typescript-eslint/func-call-spacing": ["error", "never"],
"@typescript-eslint/no-array-constructor": "error",
"@typescript-eslint/no-empty-interface": "error",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-extraneous-class": "error",
"@typescript-eslint/no-for-in-array": "error",
"@typescript-eslint/no-inferrable-types": "error",
"@typescript-eslint/no-misused-new": "error",
"@typescript-eslint/no-namespace": "error",
"@typescript-eslint/no-non-null-assertion": "warn",
"@typescript-eslint/no-unnecessary-qualifier": "error",
"@typescript-eslint/no-unnecessary-type-assertion": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/no-var-requires": "error",
"@typescript-eslint/prefer-for-of": "warn",
"@typescript-eslint/prefer-function-type": "warn",
"@typescript-eslint/prefer-includes": "error",
"@typescript-eslint/prefer-string-starts-ends-with": "error",
"@typescript-eslint/promise-function-async": "error",
"@typescript-eslint/require-array-sort-compare": "error",
"@typescript-eslint/restrict-plus-operands": "error",
"@typescript-eslint/type-annotation-spacing": "error",
"@typescript-eslint/unbound-method": "error"
},
"env": {
"node": true,
"es6": true,
"jest/globals": true
}
}
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dist/** -diff linguist-generated=true
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
# Enable version updates for npm
- package-ecosystem: 'npm'
# Look for `package.json` and `lock` files in the `root` directory
directory: '/'
# Check the npm registry for updates every day (weekdays)
schedule:
interval: 'daily'
84 changes: 84 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: 'CI'
on:
push:
branches:
- main
- develop
pull_request:


jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ["12", "14"]
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: yarn install

- name: Check format and lint
run: yarn run format-check && yarn lint

- name: Build and package
run: yarn build && yarn run package

- name: Update docs
uses: './'
- run: cat README.md

- name: Check for modified files
id: changes
run: |
echo "::set-output name=files::$(git ls-files -m)"
echo "::set-output name=count::$(git ls-files -m | wc -l)"
- uses: actions/github-script@v3.1.0
if: github.event_name == 'pull_request' && steps.changes.outputs.count != 0
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = `#### Changes detected
Please verify you have updated the files below.
<details><summary>The following files are changed during the build</summary>
\`\`\`${{ steps.changes.outputs.files }}\`\`\`
</details>
*Pusher: @${{ github.actor }}, Action: \`${{ github.event_name }}\`, Workflow: \`${{ github.workflow }}\`*`;
github.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: output
})
- name: Update dist in the repository
if: github.event_name != 'pull_request' && matrix.node-version == 12
uses: stefanzweifel/git-auto-commit-action@v4.8.0
with:
commit_message: "chore(ci): Updating dist"
file_pattern: dist/*
- name: Update readme in the repository
if: github.event_name != 'pull_request' && matrix.node-version == 12
uses: stefanzweifel/git-auto-commit-action@v4.8.0
with:
commit_message: "chore(ci): Updating dist"
file_pattern: README.md

- name: Release
if:
contains('
refs/heads/main
', github.ref) && matrix.node-version == 12
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: yarn release
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v12
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
dist/
lib/
node_modules/
8 changes: 8 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"printWidth": 120,
"tabWidth": 2,
"useTabs": false,
"singleQuote": true,
"trailingComma": "all",
"arrowParens": "avoid"
}
36 changes: 36 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
branches:
- "main"
- name: "develop"
prerelease: true

tagFormat: v${version}

plugins:
- "@semantic-release/commit-analyzer"
- "@semantic-release/release-notes-generator"
- "@semantic-release/exec"
- "@semantic-release/changelog"
- "@semantic-release/git"
- "@semantic-release/github"

verifyConditions:
- '@semantic-release/git'
analyzeCommits:
- path: "@semantic-release/commit-analyzer"
preset: "conventionalcommits"

generateNotes:
- path: "@semantic-release/release-notes-generator"
preset: "conventionalcommits"

prepare:
- path: "@semantic-release/changelog"
changelogFile: "CHANGELOG.md"

- path: "@semantic-release/git"
assets: "CHANGELOG.md"

publish:
- path: "@semantic-release/github"
assets: "CHANGELOG.md"
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @npalm
46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at dev.npalm@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
89 changes: 89 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Contributing to this repository <!-- omit in toc -->

Please take a moment to review this document in order to make the contribution process easy and effective for everyone involved. We appreciate your thought to contribute to open source. :heart: We want to make contributing as easy as possible. You are welcome to:

- Reporting a bug
- Discussing the current state of the code
- Submitting a fix
- Proposing new features

## Getting started <!-- omit in toc -->

Before you begin:

- Have you read the [code of conduct](CODE_OF_CONDUCT.md)?
- Check out the [existing issues](https://github.com/npalm/action-docs-action/issues).


## We Develop with Github

We use github to host code, to track issues and feature requests, as well as accept pull requests.

## Pull Requests

Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests:


1. [Fork](http://help.github.com/fork-a-repo/) the repo and create your branch from the default branch.

```bash
# Clone your fork of the repo into the current directory
git clone https://github.com/<your-username>/<repo-name>
# Navigate to the newly cloned directory
cd <repo-name>
# Assign the original repo to a remote called "upstream"
git remote add upstream https://github.com/<upsteam-owner>/<repo-name>

# Update the upstream
git checkout <default-branch>
git pull upstream <default-branch>

# Create your feature / fix branch
git checkout -b <topic-branch-name>
```

2. If you've added code that should be tested, add tests.
3. If you've changed APIs, update the documentation.
4. Ensure the test suite passes.
5. Make sure your code lints.
6. Commit your changes, see [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/).
7. Locally merge (or rebase) the upstream development branch into your topic branch.

```bash
git pull [--rebase] upstream <dev-branch>
```

8. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
with a clear title and description.


## Development

### Setup you local environment.

1. Ensure you have the Node.js version we use, check [.npmrc](.npmrc). You can easily run multiple NOde version with [nvm](https://github.com/nvm-sh/nvm).

2. Install dependencies `yarn install`

3. See the `package.json` how to run the test.

4. Run locally, no tests yet available.

```bash
# Overwrite defaults if needed
export INPUT_README=<README>
export INPUT_ACTIONFILE=<action.yml>
export INPUT_TOCLEVEL=2
yarn run watch
```

### Use a Consistent Coding Style

- we use spaces.
- You can try running `yarn run lint && yarn run format` for style unification


## License

By contributing, you agree that your contributions will be licensed under its MIT License.

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Niek Palm

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 7ce1d1a

Please sign in to comment.