@@ -4,11 +4,71 @@ GitHub Actions CLI
44The purpose of this tool is to work with your GitHub Actions workflows in your repositories.
55It is complementary to the GitHub CLI.
66
7- It is important ` GITHUB_TOKEN ` environment variable is set in order for it to work properly.
7+ # Basic usage
88
9- So far, three main flows are supported:
9+ Run ` github-actions-cli ` within a directory which has a clone of a GitHub repository.
10+ The tool will list the GitHub actions workflows, the actions they use, the current versions they use, and the latest
11+ versions of the actions.
1012
11- # List all workflows path and name in a specified repository.
13+ ``` text
14+ ./.github/workflows/test.yml:
15+ actions/checkout v3 ==> v3.5.3
16+ release-drafter/release-drafter v5 ==> v5.24.0
17+ actions/setup-python v4 ==> v4.7.0
18+ ./.github/workflows/publish.yml:
19+ pypa/gh-action-pypi-publish release/v1 ==> v1.8.8
20+ actions/checkout v3 ==> v3.5.3
21+ actions/setup-python v4 ==> v4.7.0
22+ ```
23+
24+ # Supported use cases
25+
26+ ``` text
27+ Usage: github-actions-cli [OPTIONS] COMMAND [ARGS]...
28+
29+ Options:
30+ -repo TEXT Repository to analyze, can be a local directory or a
31+ {OWNER}/{REPO} format [default: .]
32+ --github-token TEXT GitHub token to use, by default will use GITHUB_TOKEN
33+ environment variable
34+ --help Show this message and exit.
35+
36+ Commands:
37+ list-actions List actions in a workflow
38+ list-workflows List workflows in repository
39+ update-actions Show actions required updates in repository workflows
40+ ```
41+
42+ ## ` update-actions ` List all actions that are out of date in a repository (Default)
43+
44+ List the latest versions of actions used in a repository workflows
45+ and potentially update the workflow files.
46+
47+ For example, running ` github-actions-cli ` without any parameters will look for workflows in the
48+ current directory (` . ` ), check whether there are updates required for the actions in the workflows
49+ it finds.
50+
51+ Another example, running on a remote repository, ` github-actions-cli -repo cunla/fakeredis update-actions -u ` ,
52+ will look for the latest versions of the actions used in the repository cunla/fakeredis, and because of the ` -u `
53+ flag, it will create a commit updating the workflows to the latest.
54+
55+ > Note:
56+ > Having ` GITHUB_TOKEN ` with permissions to make commits on the repository
57+ > is required in order to write to repository.
58+
59+ Parameters:
60+
61+ ``` text
62+ Usage: cli.py update-actions [OPTIONS]
63+
64+ Show actions required updates in repository workflows
65+
66+ Options:
67+ -u, --update Do not update, list only
68+ -commit-msg TEXT Commit msg, only relevant when remote repo
69+ ```
70+
71+ ## ` list-workflows ` List all workflows path and name in a specified repository.
1272
1373Example:
1474
@@ -23,68 +83,27 @@ will return:
2383.github/workflows/test.yml
2484```
2585
26- # List all actions ` uses ` in a workflow
86+ ## ` list-actions ` List all actions ` uses ` in a workflow
2787
2888Given a repo and a workflow path, return all actions in the workflow.
2989
3090Example:
91+
3192``` shell
3293github-actions-cli -repo cunla/fakeredis list-actions .github/workflows/test.yml
3394```
3495
3596Result
97+
3698``` text
3799actions/checkout@v3
38100./.github/actions/test-coverage
39101release-drafter/release-drafter@v5
40102actions/setup-python@v4
41103```
42104
43- # Update all actions in a repository workflows
44- List the latest versions of actions used in a repository workflow and update the workflow files.
45-
46- Example for local clone of repository:
47- ``` shell
48- github-actions-cli update-actions --dry-run
49- ```
50-
51- or for remote repository without cloning:
52-
53- ``` shell
54- github-actions-cli -repo cunla/fakeredis update-actions --dry-run
55- ```
56-
57- Result:
58- ``` text
59- ./.github/workflows/test.yml:
60- release-drafter/release-drafter v5 ==> v5.24.0
61- actions/checkout v3 ==> v3.5.3
62- actions/setup-python v4 ==> v4.7.0
63- ./.github/workflows/publish.yml:
64- pypa/gh-action-pypi-publish release/v1 ==> v1.8.8
65- actions/checkout v3 ==> v3.5.3
66- actions/setup-python v4 ==> v4.7.0
67- ```
68-
69105# Installation
70106
71107``` shell
72108pip install github-actions-cli
73109```
74-
75- # Help messages
76-
77- ``` text
78- Usage: github-actions-cli [OPTIONS] COMMAND [ARGS]...
79-
80- Options:
81- -repo TEXT Repository to analyze
82- --github-token TEXT GitHub token to use, by default will use GITHUB_TOKEN
83- environment variable
84- --help Show this message and exit.
85-
86- Commands:
87- list-actions List actions in a workflow
88- list-workflows List workflows in repository
89- update-actions List actions in a workflow
90- ```
0 commit comments