Skip to content

Commit 2e48bab

Browse files
committed
Project
1 parent b65ef7f commit 2e48bab

File tree

5 files changed

+29
-11
lines changed

5 files changed

+29
-11
lines changed

.github/workflows/publish.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ jobs:
1616
deploy:
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v3.5.3
19+
- uses: actions/checkout@v2
2020
- name: Set up Python
21-
uses: actions/setup-python@v4.7.0
21+
uses: actions/setup-python@v4
2222
with:
2323
python-version: '3.11'
2424
cache-dependency-path: requirements.txt
@@ -29,7 +29,7 @@ jobs:
2929
- name: Build package
3030
run: python -m build
3131
- name: Publish package
32-
uses: pypa/gh-action-pypi-publish@v1.8.8
32+
uses: pypa/gh-action-pypi-publish@v1
3333
with:
3434
user: __token__
3535
password: ${{ secrets.PYPI_API_TOKEN }}

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## v1.0.0
2+
3+
### 🚀 Features
4+
5+
- Update github actions to latest release tag on local repo or remote repo.
6+
7+
<!--
8+
### 🐛 Bug Fixes
9+
### 🚀 Features
10+
-->

gha_cli/cli.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ def _update_workflow_content(
125125
if self.is_local_repo(repo_name):
126126
with open(workflow_path, 'w') as f:
127127
f.write(workflow_content)
128-
return
128+
click.secho(f'Updated workflow in {workflow_path}', fg='cyan')
129+
return
130+
129131
# remote
130132
repo = self.client.get_repo(repo_name)
131133
current_content = repo.get_contents(workflow_path)
@@ -135,6 +137,7 @@ def _update_workflow_content(
135137
workflow_content,
136138
current_content.sha,
137139
)
140+
click.secho(f'Committed changes to workflow in {repo_name}:{workflow_path}', fg='cyan')
138141
return res
139142

140143

@@ -144,24 +147,28 @@ def _update_workflow_content(
144147
help='GitHub token to use, by default will use GITHUB_TOKEN environment variable')
145148
@click.pass_context
146149
def cli(ctx, repo: str, github_token: str):
150+
ctx.ensure_object(dict)
147151
ctx.obj['gh'] = GithubActionsTools(github_token)
148152
ctx.obj['repo'] = repo
149153

150154

151155
@cli.command(help='List actions in a workflow')
152-
@click.option('--dry-run', default=False, help='Do not update, list only')
156+
@click.option('--dry-run', is_flag=True, default=False, help='Do not update, list only')
153157
@click.option('-commit-msg', default='Update github-actions',
154158
help='Commit msg, only relevant when remote repo')
155159
@click.pass_context
156160
def update_actions(ctx, dry_run: bool, commit_msg: str):
157161
gh, repo = ctx.obj['gh'], ctx.obj['repo']
158162
action_versions = gh.get_repo_actions_latest(repo)
159163
for wf in action_versions:
160-
click.echo(f'{wf}:')
164+
click.secho(f'{wf}:', fg='blue')
161165
for action in action_versions[wf]:
162-
s = f' {action[0]} @ {action[1]}'
166+
s = f'\t{action[0]:30} {action[1]:>5}'
163167
if action[2]:
164-
s += f' \t==> {action[2]}'
168+
old_version = action[1].split('.')
169+
new_version = action[2].split('.')
170+
color = 'red' if new_version[0] != old_version[0] else 'cyan'
171+
s += ' ==> ' + click.style(f'{action[2]}', fg=color)
165172
click.echo(s)
166173
if dry_run:
167174
return

poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ github-actions-cli = "gha_cli.cli:cli"
77

88
[tool.poetry]
99
name = "github-actions-cli"
10-
version = "1.0.0b3"
10+
version = "1.0.0"
1111
description = "GitHub Actions CLI - allows updating workflows, etc."
1212
readme = "README.md"
1313
keywords = ["GitHub Actions", "CLI"]
@@ -44,7 +44,7 @@ documentation = "https://github.com/dsoftwareinc/github-actions-cli"
4444
python = "^3.9"
4545
pygithub = "^1.59"
4646
pyyaml = "^6.0"
47-
click = "^8.1.6"
47+
click = "^8.1"
4848

4949
[tool.poetry.dev-dependencies]
5050
poetry = "^1.5"
@@ -58,4 +58,5 @@ exclude = [
5858
"__pycache__",
5959
"dist",
6060
"venv",
61+
".venv"
6162
]

0 commit comments

Comments
 (0)