Skip to content

Commit

Permalink
Add push-to-fig-autocomplete-action and ruff lint
Browse files Browse the repository at this point in the history
  • Loading branch information
grant0417 committed May 30, 2024
1 parent 363e74c commit d5a1eaf
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 21 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,29 @@ on:
push:
branches:
- main
schedule:
- cron: 0 0 * * 3

jobs:
build-completion:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: actions/setup-node@v4
- run: curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash
- run: echo "$HOME/.rye/shims" >> $GITHUB_PATH
- run: rye config --set-bool behavior.use-uv=true
- run: rye sync
- run: rye lock --update awscli
- run: rye run aws configure set plugins.aws_cli_plugin aws_cli_plugin
- run: rye run aws
- name: Build specs
run: rye run aws
continue-on-error: true
- uses: withfig/push-to-fig-autocomplete-action@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
autocomplete-spec-name: aws
spec-path: export/ts/aws.ts
specs-folder-path: export/ts/aws
pr-body: Automated PR for latest AWS CLI release
21 changes: 21 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
push:
branches:
- main

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- run: curl -sSf https://rye.astral.sh/get | RYE_INSTALL_OPTION="--yes" bash
- run: echo "$HOME/.rye/shims" >> $GITHUB_PATH
- run: rye config --set-bool behavior.use-uv=true
- run: rye sync
- run: rye lock --update awscli
- run: rye run ruff check --output-format=github .
- run: rye run aws configure set plugins.aws_cli_plugin aws_cli_plugin
- name: Build specs
run: rye run aws
continue-on-error: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ __pycache__
export
dist
.DS_Store
.ruff_cache
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ build-backend = "hatchling.build"

[tool.rye]
managed = true
dev-dependencies = []
dev-dependencies = [
"ruff>=0.4.6",
]

[tool.hatch.metadata]
allow-direct-references = true
Expand Down
23 changes: 4 additions & 19 deletions src/aws_cli_plugin/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
import re
import os
import os.path as path
from pathlib import Path
from awscli.customizations.commands import BasicCommand
from awscli.clidriver import ServiceCommand, ServiceOperation
Expand All @@ -13,21 +13,6 @@ def awscli_initialize(cli):
cli.register("building-command-table", read_commands)


def print_args(args):
for argName in args:
arg = args[argName]
argJSON = {
"name": arg.cli_name,
"type": arg.cli_type_name,
"nargs": arg.nargs,
"required": arg.required,
"documentation": arg.documentation,
"suggestions": arg.choices,
}

# print(arg.cli_name, arg.cli_type_name, arg.nargs, arg.required, arg.documentation, arg.choices)


def stripHTML(text):
return re.sub("<[^<]+?>", "", text).strip()

Expand Down Expand Up @@ -120,10 +105,10 @@ def getDescription(name, description):
if value.filename is not None:
trailing_path = value.filename
else:
trailing_path = os.path.join(name, "_description" + ".rst")
trailing_path = path.join(name, "_description" + ".rst")
root_module = value.root_module
doc_path = os.path.join(
os.path.abspath(os.path.dirname(root_module.__file__)),
doc_path = path.join(
path.abspath(path.dirname(root_module.__file__)),
"examples",
trailing_path,
)
Expand Down

0 comments on commit d5a1eaf

Please sign in to comment.