Skip to content

Commit

Permalink
feat: init
Browse files Browse the repository at this point in the history
Signed-off-by: Mateusz Urbanek <mateusz.urbanek.98@gmail.com>
  • Loading branch information
shanduur committed May 6, 2024
0 parents commit de17dbf
Show file tree
Hide file tree
Showing 14 changed files with 474 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .commitlintrc.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default {
extends: ['@commitlint/config-conventional'],
rules: {
'body-max-line-length': [0],
'footer-max-line-length': [0],
},
}
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
; https://editorconfig.org/
root = true

[*]
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
indent_size = 4
trim_trailing_whitespace = false
eclint_indent_style = unset

26 changes: 26 additions & 0 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: linters

on:
pull_request:
branches: [ '*' ]
push:
branches:
- "main"

jobs:
commitlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: wagoid/commitlint-github-action@v6
with:
configFile: .commitlintrc.mjs
token: ${{ secrets.GITHUB_TOKEN }}

shell-linters:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ludeeus/action-shellcheck@master
23 changes: 23 additions & 0 deletions .github/workflows/semantic-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: semantic-pr

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

permissions:
pull-requests: read

jobs:
pr-title:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
requireScope: true
subjectPattern: ^(?![A-Z]).+$
22 changes: 22 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: move-crds-action

on:
push:
branches:
- "main"

jobs:
move-crds-action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
git config --global user.name "GitHub Actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- uses: ./
with:
targetRepository: 'registry-operator/move-crds-action'
targetChart: 'test/chart'
targetChartVersion: '1.0.0'
apiToken: '${{ secrets.PAT }}'
files: 'test/static/*'
160 changes: 160 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @registry-operator/core
24 changes: 24 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

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 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.

For more information, please refer to <https://unlicense.org>
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Move CRDs Action

A GitHub Action for moving Custom Resource Definitions (CRDs) between repositories. This action handles copying CRD files from a source location to a target repository and can create or update pull requests to manage these changes.

## Usage

To use this action, include it in your GitHub workflow as shown below:

```yaml
name: move-crds-action

on:
push:
branches:
- "main"

permissions:
contents: write
pull-requests: write

jobs:
move-crds-action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: |
git config --global user.name "GitHub Actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- uses: ./
with:
targetRepository: 'shanduur/move-crds-action'
targetChart: 'test/chart'
targetChartVersion: '1.0.0'
apiToken: '${{ secrets.GITHUB_TOKEN }}'
files: 'test/static/*'
```

## Inputs

- `targetRepository`: The target repository in which to move the CRD files. The format should be "owner/repo" (e.g., "myuser/myrepo"). (Required)

- `targetChart`: The name of the target chart in the target repository where the CRDs should be added or updated. (Required)

- `targetChartVersion`: The version of the target chart in the target repository. The CRDs will be added to the chart at this version. (Required)

- `files`: A glob pattern to specify the CRD files to be moved. The pattern should match the files to be copied from the source location to the target repository. (Required)

- `apiToken`: The GitHub API token for authentication and API access. By default, uses the `GITHUB_TOKEN` secret provided by the GitHub workflow context. (Required)

- `title`: The title for the pull request when copying CRDs to the target repository. This title will be used for the PR creation or update process. (Optional, default: `'chore(crds): copied CRDs'`)

- `commitMessage`: The commit message to use when copying CRDs to the target repository. This message will be used when creating the commit in the target repository. (Optional, default: `'chore(crds): copied CRDs'`)

- `author`: The name of the author to use when creating the pull request. If not provided, the default GitHub Actions bot will be used. (Optional, default: `'actions'`)

## How It Works

The action runs a bash script that:

1. Copies the specified CRD files from the source repository to the target repository.
2. Creates or updates a pull request with the specified title, commit message, and author in the target repository.

## License

This project is licensed under [The Unlicense](LICENSE). Please see the license file for more information.
Loading

0 comments on commit de17dbf

Please sign in to comment.