Skip to content

Commit

Permalink
feat: init action repo with cookiecutter (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
flukolo4ek authored Oct 23, 2024
1 parent b9d7e86 commit 25f7999
Show file tree
Hide file tree
Showing 18 changed files with 2,348 additions and 1 deletion.
13 changes: 13 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
max_line_length = 120
trim_trailing_whitespace = true

[*.sh]
indent_size = 4
16 changes: 16 additions & 0 deletions .github/actions/setup_environment/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "Setup Environment"
description: "Setting environment for the project"

inputs:
task-version:
description: "Task version"
required: true
default: "3.33.1"

runs:
using: "composite"
steps:
- name: Install Task
uses: arduino/setup-task@v1
with:
version: ${{ inputs.task-version }}
22 changes: 22 additions & 0 deletions .github/workflows/check-pr-title.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Check PR Title

on:
pull_request:
types:
- opened
- reopened
- synchronize
- edited

jobs:
check-pr-title:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Commitlint PR Title
uses: ovsds/commitlint-pr-title-action@v1
with:
config_file: ./commitlint.config.js
30 changes: 30 additions & 0 deletions .github/workflows/check-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check PR

on:
pull_request:
types:
- opened
- reopened
- synchronize

jobs:
check-pr:
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Environment
uses: ./.github/actions/setup_environment

- name: Install Dependencies
run: |
task init
- name: Lint PR
run: |
task lint
44 changes: 44 additions & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: E2E

on:
pull_request:
types:
- opened
- reopened
- synchronize

jobs:
e2e-default:
runs-on: ubuntu-latest

permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Test Run
id: test-run
uses: ./
with:
placeholder: "test_placeholder"

- name: Assert placeholder
uses: nick-fields/assert-action@v2
with:
actual: ${{ steps.test-run.outputs.placeholder }}
expected: "test_placeholder"
e2e:
runs-on: ubuntu-latest
if: always() && !cancelled()

needs:
- e2e-default

steps:
- name: Collect Results
uses: ovsds/collect-needs-result-action@v1
with:
needs_json: ${{ toJson(needs) }}
skip_allowed: false
18 changes: 18 additions & 0 deletions .github/workflows/push-version-tags.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Push version tags

on:
release:
types: [published]

jobs:
push-version-tags:
runs-on: ubuntu-latest

permissions:
contents: write

steps:
- name: Push Version Tags
uses: ovsds/push-version-tags-action@v1
with:
version: ${{ github.event.release.tag_name }}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# OS
.DS_Store

# IDE
.idea/
.vscode/

# Dependencies
node_modules/
1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx lint-staged
6 changes: 6 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
fund=false
audit=false
save-exact=true
unsafe-perm=true
engine-strict=true
update-notifier=false
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.15.1
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) 2024 datalens-tech

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.
50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,49 @@
# fix-dubious-ownership-action
# fix-dubious-ownership-action

[![CI](https://github.com/datalens-tech/fix-dubious-ownership-action/workflows/Check%20PR/badge.svg)](https://github.com/datalens-tech/fix-dubious-ownership-action/actions?query=workflow%3A%22%22Check+PR%22%22)
[![GitHub Marketplace](https://img.shields.io/badge/Marketplace-fix-dubious-ownership-action-blue.svg)](https://github.com/marketplace/actions/fix-dubious-ownership-action)

fix-dubious-ownership-action

## Usage

### Example

```yaml
jobs:
fix-dubious-ownership-action:
permissions:
contents: read

steps:
- name: fix-dubious-ownership-action
id: fix-dubious-ownership-action
uses: datalens-tech/fix-dubious-ownership-action@v1
```
### Action Inputs
| Name | Description | Default |
| ------------- | ------------ | ------- |
| `placeholder` | Placeholder. | |

### Action Outputs

| Name | Description |
| ------------- | ------------ |
| `placeholder` | Placeholder. |

## Development

### Global dependencies

- [Taskfile](https://taskfile.dev/installation/)
- [nvm](https://github.com/nvm-sh/nvm?tab=readme-ov-file#install--update-script)

### Taskfile commands

For all commands see [Taskfile](Taskfile.yaml) or `task --list-all`.

## License

[MIT](LICENSE)
76 changes: 76 additions & 0 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
version: 3

silent: true

vars:
NENV: "node_modules"

tasks:
_prettier:
internal: true
cmds:
- "{{.NENV}}/.bin/prettier {{.COMMAND}}"

_with_nvm:
internal: true
cmds:
- "source ${HOME}/.nvm/nvm.sh && nvm install && {{.COMMAND}}"

init:
desc: Initialize project environment
cmds:
- echo 'Installing node dependencies...'
- task: _with_nvm
vars: { COMMAND: "npm install" }

- echo 'Installing husky pre-commit...'
- task: _with_nvm
vars: { COMMAND: "npm run prepare" }

lint:
desc: Lint project
cmds:
- task: _with_nvm
vars: { COMMAND: "npm run lint:check" }

lint-fix:
desc: Lint fix project
cmds:
- task: _with_nvm
vars: { COMMAND: "npm run lint:fix" }

clean:
desc: Clean project environment
cmds:
- echo 'Cleaning node dependencies...'
- rm -rf {{.NENV}}

dependencies-update:
desc: Update dependencies
cmds:
- echo 'Updating node dependencies...'
- task: _with_nvm
vars: { COMMAND: "npm update" }
- task: _with_nvm
vars: { COMMAND: "npm outdated" }
- task: _with_nvm
vars: { COMMAND: "npm audit" }

update-from-template:
desc: Update project from template
cmds:
- echo 'Updating project from template...'
- cookiecutter
--no-input
--overwrite-if-exists
--output-dir ../
{{.TEMPLATE_PATH}}
project_name='fix-dubious-ownership-action'
project_slug='fix-dubious-ownership-action'
marketplace_name='fix-dubious-ownership-action'
action_type='composite'
node_version='v20.15.1'
owner_name='datalens-tech'
owner_github_login='datalens-tech'
vars:
TEMPLATE_PATH: '{{.TEMPLATE_PATH | default "https://github.com/ovsds/template-repository-github-action"}}'
27 changes: 27 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "fix-dubious-ownership-action"
description: "fix-dubious-ownership-action"

inputs:
placeholder:
description: "Placeholder input to be replaced by real inputs"
required: true
default: "placeholder"

outputs:
placeholder:
description: "Placeholder output to be replaced by real outputs"
value: ${{steps.placeholder.outputs.placeholder }}

runs:
using: "composite"
steps:
- name: Placeholder
id: placeholder
shell: bash
run: |
echo "::set-output name=placeholder::${{ inputs.placeholder }}"
# https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions#branding
branding:
icon: "message-square"
color: "gray-dark"
3 changes: 3 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"use strict";

module.exports = { extends: ["@commitlint/config-conventional"] };
Loading

0 comments on commit 25f7999

Please sign in to comment.