diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 5d6fc08..860be11 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.0.9 +current_version = 1.0.0 commit = True tag = False diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..afb98ae --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: +- package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml new file mode 100644 index 0000000..d537315 --- /dev/null +++ b/.github/workflows/auto-approve.yml @@ -0,0 +1,32 @@ +name: Auto approve + +on: + pull_request_target + +jobs: + auto-approve: + runs-on: ubuntu-latest + steps: + - uses: hmarr/auto-approve-action@v2 + if: | + ( + github.event.pull_request.user.login == 'dependabot[bot]' || + github.event.pull_request.user.login == 'dependabot' || + github.event.pull_request.user.login == 'dependabot-preview[bot]' || + github.event.pull_request.user.login == 'dependabot-preview' || + github.event.pull_request.user.login == 'renovate[bot]' || + github.event.pull_request.user.login == 'renovate' || + github.event.pull_request.user.login == 'github-actions[bot]' + ) + && + ( + github.actor == 'dependabot[bot]' || + github.actor == 'dependabot' || + github.actor == 'dependabot-preview[bot]' || + github.actor == 'dependabot-preview' || + github.actor == 'renovate[bot]' || + github.actor == 'renovate' || + github.actor == 'github-actions[bot]' + ) + with: + github-token: ${{ secrets.PAT_TOKEN }} diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml new file mode 100644 index 0000000..59f687f --- /dev/null +++ b/.github/workflows/auto-merge.yml @@ -0,0 +1,26 @@ +name: automerge +on: + check_suite: + types: + - completed + +jobs: + automerge: + runs-on: ubuntu-latest + if: | + github.actor == 'dependabot[bot]' || + github.actor == 'dependabot' || + github.actor == 'dependabot-preview[bot]' || + github.actor == 'dependabot-preview' || + github.actor == 'renovate[bot]' || + github.actor == 'renovate' + steps: + - name: automerge + uses: pascalgn/automerge-action@v0.15.3 + env: + GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} + MERGE_METHOD: "rebase" + UPDATE_METHOD: "rebase" + MERGE_RETRIES: "6" + MERGE_RETRY_SLEEP: "100000" + MERGE_LABELS: "" diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d2d45d1..07d47a7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -8,16 +8,16 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Run semver-diff id: semver-diff - uses: tj-actions/semver-diff@v1.2.0 + uses: tj-actions/semver-diff@v2.0.0 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: '3.6.x' @@ -43,10 +43,10 @@ jobs: TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - name: Generate CHANGELOG - uses: tj-actions/github-changelog-generator@v1.8 + uses: tj-actions/github-changelog-generator@v1.13 - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: base: "main" title: "Upgraded ${{ steps.semver-diff.outputs.old_version }} → ${{ steps.semver-diff.outputs.new_version }}" diff --git a/CHANGELOG.md b/CHANGELOG.md index a1afd81..4b51c49 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [v1.0.0](https://github.com/tj-python/github-deploy/tree/v1.0.0) (2022-02-12) + +[Full Changelog](https://github.com/tj-python/github-deploy/compare/0.0.9...v1.0.0) + +**Merged pull requests:** + +- Upgraded 0.0.8 → 0.0.9 [\#7](https://github.com/tj-python/github-deploy/pull/7) ([jackton1](https://github.com/jackton1)) + ## [0.0.9](https://github.com/tj-python/github-deploy/tree/0.0.9) (2022-02-11) [Full Changelog](https://github.com/tj-python/github-deploy/compare/0.0.8...0.0.9) diff --git a/README.md b/README.md index d36c7f4..b099986 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ [![PyPI version](https://badge.fury.io/py/github-deploy.svg)](https://badge.fury.io/py/github-deploy) [![Upload Python Package](https://github.com/tj-python/github-deploy/actions/workflows/deploy.yml/badge.svg)](https://github.com/tj-python/github-deploy/actions/workflows/deploy.yml) [![Downloads](https://pepy.tech/badge/github-deploy)](https://pepy.tech/project/github-deploy) +[![Total alerts](https://img.shields.io/lgtm/alerts/g/tj-python/github-deploy.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/tj-python/github-deploy/alerts/) +[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/tj-python/github-deploy.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/tj-python/github-deploy/context:python) # github-deploy @@ -24,19 +26,27 @@ This can introduce a number challenges one of which is maintaining consistency a pip install github-deploy ``` +## Setup +A Personal Access Token which can be created using this [guide](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) + +### Required Scopes +The required scopes are `repo` and `workflow` +Screen Shot 2022-06-11 at 8 16 01 AM + + ## Usage -### Creating or Updating files on github +### Upload files to github ```shell script -gh-deploy update --org [org] --token [PAT_TOKEN] --dest [LOCATION TO UPLOAD FILE] --source [SOURCE FILE LOCATION] +gh-deploy upload --org [org] --token [PAT_TOKEN] --dest [LOCATION TO UPLOAD FILE] --source [SOURCE FILE LOCATION] ``` Example: ```shell script -gh-deploy update --org tj-actions --token [PAT_TOKEN] --dest '.github/workflows/auto-approve.yml' --source auto-approve.yml +gh-deploy upload --org tj-actions --token [PAT_TOKEN] --dest '.github/workflows/auto-approve.yml' --source auto-approve.yml ``` > NOTE: `auto-approve.yml` is located on your local system. diff --git a/github_deploy/main.py b/github_deploy/main.py index bec9463..2acef84 100644 --- a/github_deploy/main.py +++ b/github_deploy/main.py @@ -17,10 +17,14 @@ def list_commands(self, ctx): def get_command(self, ctx, name): ns = {} fn = os.path.join(plugin_folder, name + '.py') - with open(fn) as f: - code = compile(f.read(), fn, 'exec') - eval(code, ns, ns) - return ns['main'] + + if os.path.exists(fn): + with open(fn) as f: + code = compile(f.read(), fn, 'exec') + eval(code, ns, ns) + return ns['main'] + + ctx.fail("Invalid Command: {name}".format(name=name)) main = GithubDeploy( diff --git a/setup.py b/setup.py index 2c7d1f9..d5a2463 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ setup( name="github-deploy", - version="0.0.9", + version="1.0.0", description="Deploy yaml files to a large number of repositories in seconds.", long_description=LONG_DESCRIPTION, long_description_content_type=LONG_DESCRIPTION_TYPE,