No project description provided
Project description
JSON 轉 GitHub Actions YAML
這個 Python 套件能將 JSON 格式轉化為 GitHub Actions 的 YAML 格式。
安裝
將 json_to_github_actions.py
放到您的專案資料夾中
CLI 用法
python json_to_github_actions.py --json_file [json_file] --yaml_file [yaml_file]
範例:
python json_to_github_actions.py --json_file input.json --yaml_file output.yaml
輸入 json_file
是您的 JSON 檔案路徑,並將產生的 GitHub Actions YAML 檔案保存到給定的 yaml_file
路徑。
套件 import 用法
首先,將 json_to_github_actions.py
腳本導入您的專案。
from json_to_github_actions import json_to_github_actions
然後您可以調用 json_to_github_actions()
函數將 JSON 輸入轉換為 YAML 格式。
json_data = '''
{
"repo_url": "https://github.com/user/repo",
"script_dir": "scripts",
"script_name": "main.py",
"execution_environment": [
{
"language": "python",
"version": "3.8",
"installation_command": "pip install -r requirements.txt"
}
],
"json_parameters": [
{"param1": "value1", "param2": 42},
{"param1": "value2", "param2": 24}
],
"max_parallel": 2
}
'''
yaml_data = json_to_github_actions(json_data)
這將把 JSON 格式的數據轉換為適用於 GitHub Actions 的 YAML 格式。之後,您可以選擇將 yaml_data
保存到檔案中。
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for json-to-github-actions-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 12aea84071fac53dbd3abfe2a5918e8c70b33d9d3e5b09117c2cc2fc2869a191 |
|
MD5 | 49494b8ca819c0e4c9f000c3acadeb20 |
|
BLAKE2b-256 | 7b5b5e7fb10de60f02b209975309513484ed8319b0c97be07074d7a0217e5891 |
Close
Hashes for json_to_github_actions-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b6011a06b0d11b543e59741d261108f3035e476566987db41d86ed0dac4ed7db |
|
MD5 | 738f90e801a249006a32e9441226fb79 |
|
BLAKE2b-256 | 58224fc2fde9fadb143c35030d48419f429cf642a8a381291daa831c7b9a5068 |