actions-tools 0.2.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- actions/__init__.py +12 -0
- actions/context.py +50 -0
- actions/core.py +380 -0
- actions/py.typed +0 -0
- actions_tools-0.2.1.dist-info/METADATA +296 -0
- actions_tools-0.2.1.dist-info/RECORD +9 -0
- actions_tools-0.2.1.dist-info/WHEEL +5 -0
- actions_tools-0.2.1.dist-info/licenses/LICENSE +674 -0
- actions_tools-0.2.1.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: actions-tools
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: A Typed Python GitHub Actions Tookit similar to actions/toolkit.
|
|
5
|
+
Author: Shane
|
|
6
|
+
License: GPL-3.0
|
|
7
|
+
Project-URL: Homepage, https://cssnr.com/
|
|
8
|
+
Project-URL: Documentation, https://actions-tools.cssnr.com/
|
|
9
|
+
Project-URL: Source, https://github.com/cssnr/actions-tools
|
|
10
|
+
Project-URL: Issues, https://github.com/cssnr/actions-tools/issues
|
|
11
|
+
Project-URL: Funding, https://ko-fi.com/cssnr
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
|
|
22
|
+
Classifier: Natural Language :: English
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: PyYAML
|
|
27
|
+
Provides-Extra: github
|
|
28
|
+
Requires-Dist: PyGithub<3,>=2; extra == "github"
|
|
29
|
+
Dynamic: license-file
|
|
30
|
+
|
|
31
|
+
[](https://pypi.org/project/actions-tools/)
|
|
32
|
+
[](https://github.com/cssnr/actions-tools/releases)
|
|
33
|
+
[](https://github.com/cssnr/actions-tools?tab=readme-ov-file#readme)
|
|
34
|
+
[](https://pepy.tech/projects/actions-tools)
|
|
35
|
+
[](https://codecov.io/gh/cssnr/actions-tools)
|
|
36
|
+
[](https://sonarcloud.io/summary/new_code?id=cssnr_actions-tools)
|
|
37
|
+
[](https://github.com/cssnr/actions-tools/actions/workflows/release.yaml)
|
|
38
|
+
[](https://github.com/cssnr/actions-tools/actions/workflows/lint.yaml)
|
|
39
|
+
[](https://github.com/cssnr/actions-tools/actions/workflows/test.yaml)
|
|
40
|
+
[](https://pypi.org/project/actions-tools/)
|
|
41
|
+
[](https://actions-tools.cssnr.com/)
|
|
42
|
+
[](https://github.com/cssnr/actions-tools?tab=readme-ov-file#readme)
|
|
43
|
+
[](https://github.com/cssnr/actions-tools/graphs/commit-activity)
|
|
44
|
+
[](https://github.com/cssnr/actions-tools/graphs/contributors)
|
|
45
|
+
[](https://github.com/cssnr/actions-tools)
|
|
46
|
+
[](https://github.com/cssnr/actions-tools/forks)
|
|
47
|
+
[](https://github.com/cssnr/actions-tools/stargazers)
|
|
48
|
+
[](https://cssnr.github.io/)
|
|
49
|
+
[](https://discord.gg/wXy6m2X8wY)
|
|
50
|
+
[](https://ko-fi.com/cssnr)
|
|
51
|
+
|
|
52
|
+
# Actions Tools
|
|
53
|
+
|
|
54
|
+
- [Install](#Install)
|
|
55
|
+
- [Usage](#Usage)
|
|
56
|
+
- [Support](#Support)
|
|
57
|
+
- [Contributing](#Contributing)
|
|
58
|
+
|
|
59
|
+
<p align="center"><a title="Actions Tools Docs" href="https://actions-tools.cssnr.com/" target="_blank">
|
|
60
|
+
<img alt="Actions Tools Docs" width="256" height="auto" src="https://raw.githubusercontent.com/smashedr/repo-images/refs/heads/master/actions-tools/logo256.png" />
|
|
61
|
+
</a></p>
|
|
62
|
+
|
|
63
|
+
A Typed Python GitHub Actions Tookit similar to [actions/toolkit](https://github.com/actions/toolkit).
|
|
64
|
+
|
|
65
|
+
- http://actions-tools.cssnr.com
|
|
66
|
+
|
|
67
|
+
> [!NOTE]
|
|
68
|
+
> This project is in active development.
|
|
69
|
+
> Please [let us know](https://github.com/cssnr/actions-tools/discussions/categories/feature-requests)
|
|
70
|
+
> what features you want to see.
|
|
71
|
+
> The [Documentation Site](https://actions-tools.cssnr.com/) is also a work in progress...
|
|
72
|
+
|
|
73
|
+
## Install
|
|
74
|
+
|
|
75
|
+
From PyPI: https://pypi.org/p/actions-tools
|
|
76
|
+
|
|
77
|
+
```shell
|
|
78
|
+
python -m pip install actions-tools
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
With [PyGithub](https://github.com/PyGithub/PyGithub) (for GitHub API access).
|
|
82
|
+
|
|
83
|
+
```shell
|
|
84
|
+
python -m pip install actions-tools[github]
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Install from source.
|
|
88
|
+
|
|
89
|
+
```shell
|
|
90
|
+
git clone https://github.com/cssnr/actions-tools
|
|
91
|
+
python -m pip install actions-tools
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Uninstall.
|
|
95
|
+
|
|
96
|
+
```shell
|
|
97
|
+
python -m pip uninstall actions-tools
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Usage
|
|
101
|
+
|
|
102
|
+
A [usage guide](https://actions-tools.cssnr.com/usage/) is available on the [documentation site](https://actions-tools.cssnr.com/).
|
|
103
|
+
|
|
104
|
+
Functionality from @actions/toolkit
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
from actions import core, context
|
|
108
|
+
|
|
109
|
+
# Input
|
|
110
|
+
my_str = core.get_input("string") # -> str
|
|
111
|
+
my_req = core.get_input("string", True) # required
|
|
112
|
+
my_bool = core.get_bool("boolean") # -> bool
|
|
113
|
+
my_list = core.get_list("list") # -> list
|
|
114
|
+
my_dict = core.get_dict("dict") # -> dict - from json or yaml
|
|
115
|
+
my_data = core.get_dict("data") # -> Any - from json or yaml
|
|
116
|
+
|
|
117
|
+
# Context
|
|
118
|
+
# https://docs.github.com/en/actions/reference/workflows-and-actions/variables
|
|
119
|
+
core.info(f"event_name: {context.event_name}")
|
|
120
|
+
core.info(f"ref_name: {context.ref_name}")
|
|
121
|
+
core.info(f"runner_temp: {context.runner_temp}")
|
|
122
|
+
|
|
123
|
+
# Event
|
|
124
|
+
# https://docs.github.com/en/webhooks/webhook-events-and-payloads
|
|
125
|
+
event = core.get_event() # -> dict
|
|
126
|
+
core.info(str(event))
|
|
127
|
+
repository = event.get("repository")
|
|
128
|
+
|
|
129
|
+
# Logging
|
|
130
|
+
core.info("info") # alias for print
|
|
131
|
+
core.debug("debug")
|
|
132
|
+
|
|
133
|
+
# Annotations
|
|
134
|
+
# https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#setting-a-notice-message
|
|
135
|
+
core.notice("notice")
|
|
136
|
+
core.warn("warn")
|
|
137
|
+
core.error("error", title="Title", file="File", col=1, endColumn=2, line=3, endLine=4)
|
|
138
|
+
|
|
139
|
+
# Blocks
|
|
140
|
+
core.start_group("Title")
|
|
141
|
+
core.info("This is folded.")
|
|
142
|
+
core.end_group()
|
|
143
|
+
|
|
144
|
+
with core.group("Title") as p:
|
|
145
|
+
p("This is folded.")
|
|
146
|
+
core.info("Also folded.")
|
|
147
|
+
|
|
148
|
+
# Environment
|
|
149
|
+
core.set_env("NAME", "value")
|
|
150
|
+
|
|
151
|
+
# State
|
|
152
|
+
name = core.set_state("name", "value")
|
|
153
|
+
value = core.get_state("name")
|
|
154
|
+
|
|
155
|
+
# System Path
|
|
156
|
+
core.add_path("/dev/null")
|
|
157
|
+
|
|
158
|
+
# Set Secret
|
|
159
|
+
core.mask("super-secret-string")
|
|
160
|
+
|
|
161
|
+
# Outputs
|
|
162
|
+
core.set_output("name", "cssnr")
|
|
163
|
+
|
|
164
|
+
# Commands
|
|
165
|
+
core.stop_commands()
|
|
166
|
+
core.info("::error::log output with commands")
|
|
167
|
+
core.start_commands()
|
|
168
|
+
|
|
169
|
+
# Summary
|
|
170
|
+
core.summary("## Test Action")
|
|
171
|
+
|
|
172
|
+
# Abort
|
|
173
|
+
core.set_failed("Mayday!")
|
|
174
|
+
|
|
175
|
+
# Runner Debug
|
|
176
|
+
core.is_debug()
|
|
177
|
+
|
|
178
|
+
# PyGithub (Octokit)
|
|
179
|
+
# https://pygithub.readthedocs.io/en/stable/
|
|
180
|
+
token = core.get_input("token", True)
|
|
181
|
+
g = core.get_github(token)
|
|
182
|
+
repo = g.get_repo(f"{context.repository}")
|
|
183
|
+
core.info(f"repo.name: {repo.name}")
|
|
184
|
+
|
|
185
|
+
# OIDC Token
|
|
186
|
+
# https://docs.github.com/en/actions/reference/security/oidc
|
|
187
|
+
id_token = core.get_id_token()
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
- Full `core` reference: [../src/actions/core.py](https://github.com/cssnr/actions-tools/blob/master/src/actions/core.py)
|
|
191
|
+
- Full `context` reference: [../src/actions/context.py](https://github.com/cssnr/actions-tools/blob/master/src/actions/context.py)
|
|
192
|
+
|
|
193
|
+
Functionality new in actions-tools
|
|
194
|
+
|
|
195
|
+
```python
|
|
196
|
+
from actions import core, context
|
|
197
|
+
|
|
198
|
+
# Context
|
|
199
|
+
core.info(f"repository_name: {context.repository_name}")
|
|
200
|
+
|
|
201
|
+
# Commands
|
|
202
|
+
core.command("warning", "Warned!") # core.warn()
|
|
203
|
+
|
|
204
|
+
# Action Version
|
|
205
|
+
version = core.get_version() # from GITHUB_WORKFLOW_REF
|
|
206
|
+
|
|
207
|
+
# Random
|
|
208
|
+
rand = core.get_random(32)
|
|
209
|
+
|
|
210
|
+
# Indent
|
|
211
|
+
core.start_indent(4)
|
|
212
|
+
core.info("Indented") # only works with core.info
|
|
213
|
+
core.end_indent()
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
- Example py action: [smashedr/test-action-py](https://github.com/smashedr/test-action-py/blob/master/src/main.py)
|
|
217
|
+
- Example uv action: [smashedr/test-action-uv](https://github.com/smashedr/test-action-uv/blob/master/src/main.py)
|
|
218
|
+
|
|
219
|
+
# Support
|
|
220
|
+
|
|
221
|
+
For general help or to request a feature, see:
|
|
222
|
+
|
|
223
|
+
- Q&A Discussion: https://github.com/cssnr/actions-tools/discussions/categories/q-a
|
|
224
|
+
- Request a Feature: https://github.com/cssnr/actions-tools/discussions/categories/feature-requests
|
|
225
|
+
- Chat with us on Discord: https://discord.gg/wXy6m2X8wY
|
|
226
|
+
|
|
227
|
+
If you are experiencing an issue/bug or getting unexpected results, you can:
|
|
228
|
+
|
|
229
|
+
- Report an Issue: https://github.com/cssnr/actions-tools/issues
|
|
230
|
+
- Provide General Feedback: [https://cssnr.github.io/feedback/](https://cssnr.github.io/feedback/?app=actions-tools)
|
|
231
|
+
- Chat with us on Discord: https://discord.gg/wXy6m2X8wY
|
|
232
|
+
|
|
233
|
+
# Contributing
|
|
234
|
+
|
|
235
|
+
If you would like to submit a PR, please review the [CONTRIBUTING.md](#contributing-ov-file).
|
|
236
|
+
|
|
237
|
+
Please consider making a donation to support the development of this project
|
|
238
|
+
and [additional](https://cssnr.com/) open source projects.
|
|
239
|
+
|
|
240
|
+
[](https://ko-fi.com/cssnr)
|
|
241
|
+
|
|
242
|
+
Additionally, you can support other [GitHub Actions](https://actions.cssnr.com/) I have published:
|
|
243
|
+
|
|
244
|
+
- [Stack Deploy Action](https://github.com/cssnr/stack-deploy-action?tab=readme-ov-file#readme)
|
|
245
|
+
- [Portainer Stack Deploy Action](https://github.com/cssnr/portainer-stack-deploy-action?tab=readme-ov-file#readme)
|
|
246
|
+
- [Docker Context Action](https://github.com/cssnr/docker-context-action?tab=readme-ov-file#readme)
|
|
247
|
+
- [Actions Up Action](https://github.com/cssnr/actions-up-action?tab=readme-ov-file#readme)
|
|
248
|
+
- [VirusTotal Action](https://github.com/cssnr/virustotal-action?tab=readme-ov-file#readme)
|
|
249
|
+
- [Mirror Repository Action](https://github.com/cssnr/mirror-repository-action?tab=readme-ov-file#readme)
|
|
250
|
+
- [Update Version Tags Action](https://github.com/cssnr/update-version-tags-action?tab=readme-ov-file#readme)
|
|
251
|
+
- [Docker Tags Action](https://github.com/cssnr/docker-tags-action?tab=readme-ov-file#readme)
|
|
252
|
+
- [Update JSON Value Action](https://github.com/cssnr/update-json-value-action?tab=readme-ov-file#readme)
|
|
253
|
+
- [JSON Key Value Check Action](https://github.com/cssnr/json-key-value-check-action?tab=readme-ov-file#readme)
|
|
254
|
+
- [Parse Issue Form Action](https://github.com/cssnr/parse-issue-form-action?tab=readme-ov-file#readme)
|
|
255
|
+
- [Cloudflare Purge Cache Action](https://github.com/cssnr/cloudflare-purge-cache-action?tab=readme-ov-file#readme)
|
|
256
|
+
- [Mozilla Addon Update Action](https://github.com/cssnr/mozilla-addon-update-action?tab=readme-ov-file#readme)
|
|
257
|
+
- [Package Changelog Action](https://github.com/cssnr/package-changelog-action?tab=readme-ov-file#readme)
|
|
258
|
+
- [NPM Outdated Check Action](https://github.com/cssnr/npm-outdated-action?tab=readme-ov-file#readme)
|
|
259
|
+
- [Label Creator Action](https://github.com/cssnr/label-creator-action?tab=readme-ov-file#readme)
|
|
260
|
+
- [Algolia Crawler Action](https://github.com/cssnr/algolia-crawler-action?tab=readme-ov-file#readme)
|
|
261
|
+
- [Upload Release Action](https://github.com/cssnr/upload-release-action?tab=readme-ov-file#readme)
|
|
262
|
+
- [Check Build Action](https://github.com/cssnr/check-build-action?tab=readme-ov-file#readme)
|
|
263
|
+
- [Web Request Action](https://github.com/cssnr/web-request-action?tab=readme-ov-file#readme)
|
|
264
|
+
- [Get Commit Action](https://github.com/cssnr/get-commit-action?tab=readme-ov-file#readme)
|
|
265
|
+
|
|
266
|
+
<details><summary>❔ Unpublished Actions</summary>
|
|
267
|
+
|
|
268
|
+
These actions are not published on the Marketplace, but may be useful.
|
|
269
|
+
|
|
270
|
+
- [cssnr/create-files-action](https://github.com/cssnr/create-files-action?tab=readme-ov-file#readme) - Create various files from templates.
|
|
271
|
+
- [cssnr/draft-release-action](https://github.com/cssnr/draft-release-action?tab=readme-ov-file#readme) - Keep a draft release ready to publish.
|
|
272
|
+
- [cssnr/env-json-action](https://github.com/cssnr/env-json-action?tab=readme-ov-file#readme) - Convert env file to json or vice versa.
|
|
273
|
+
- [cssnr/push-artifacts-action](https://github.com/cssnr/push-artifacts-action?tab=readme-ov-file#readme) - Sync files to a remote host with rsync.
|
|
274
|
+
- [smashedr/update-release-notes-action](https://github.com/smashedr/update-release-notes-action?tab=readme-ov-file#readme) - Update release notes.
|
|
275
|
+
- [smashedr/combine-release-notes-action](https://github.com/smashedr/combine-release-notes-action?tab=readme-ov-file#readme) - Combine release notes.
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
</details>
|
|
280
|
+
|
|
281
|
+
<details><summary>📝 Template Actions</summary>
|
|
282
|
+
|
|
283
|
+
These are basic action templates that I use for creating new actions.
|
|
284
|
+
|
|
285
|
+
- [js-test-action](https://github.com/smashedr/js-test-action?tab=readme-ov-file#readme) - JavaScript
|
|
286
|
+
- [ts-test-action](https://github.com/smashedr/ts-test-action?tab=readme-ov-file#readme) - TypeScript
|
|
287
|
+
- [py-test-action](https://github.com/smashedr/py-test-action?tab=readme-ov-file#readme) - Python (Dockerfile)
|
|
288
|
+
- [docker-test-action](https://github.com/smashedr/docker-test-action?tab=readme-ov-file#readme) - Docker (Image)
|
|
289
|
+
|
|
290
|
+
Note: The `docker-test-action` builds, runs and pushes images to [GitHub Container Registry](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry).
|
|
291
|
+
|
|
292
|
+
---
|
|
293
|
+
|
|
294
|
+
</details>
|
|
295
|
+
|
|
296
|
+
For a full list of current projects visit: [https://cssnr.github.io/](https://cssnr.github.io/)
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
actions/__init__.py,sha256=RKS7P331MqH0IazQa_K0GZ-lNr3UugtpkxVPBPd7ZGQ,261
|
|
2
|
+
actions/context.py,sha256=0cnb2NuvtUccraGTeK0x7d5cKxWdtZObSeOcwuXYWK0,2528
|
|
3
|
+
actions/core.py,sha256=RCRfCUoqpTXBxQ5dkmIloiFi7dRiKJdOqr6Qln_jQYM,9908
|
|
4
|
+
actions/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
actions_tools-0.2.1.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
6
|
+
actions_tools-0.2.1.dist-info/METADATA,sha256=puMxSLfmJ6n_cx_CFMDGC3vReKFvwl1Ut7L_RqQ1KQo,14139
|
|
7
|
+
actions_tools-0.2.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
8
|
+
actions_tools-0.2.1.dist-info/top_level.txt,sha256=5apM5x80QlJcGbACn1v3fkmIuL1-XQCKcItJre7w7Tw,8
|
|
9
|
+
actions_tools-0.2.1.dist-info/RECORD,,
|