diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3092348..0df540d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,7 +6,35 @@ on: pull_request: workflow_dispatch: +# Install StructKit via the published major tag. v0 exists on +# httpdss/structkit-setup (same commit as v0.0.1). +permissions: + contents: read + actions: write + jobs: + test-requires-structkit-on-path: + name: Test Requires StructKit on PATH + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v7 + + - name: Run without StructKit + id: missing + continue-on-error: true + uses: ./ + with: + command: validate + + - name: Expect PATH error + run: | + if [[ "${{ steps.missing.outcome }}" != "failure" ]]; then + echo "Expected the action to fail when structkit is not on PATH" + exit 1 + fi + echo "Missing structkit failed as expected" + test-validate: name: Test Validate Command runs-on: ubuntu-latest @@ -14,6 +42,9 @@ jobs: - name: Checkout uses: actions/checkout@v7 + - name: Set up StructKit + uses: httpdss/structkit-setup@v0 + - name: Create test structure file run: | cat > .structkit.yaml << 'EOF' @@ -35,6 +66,9 @@ jobs: - name: Checkout uses: actions/checkout@v7 + - name: Set up StructKit + uses: httpdss/structkit-setup@v0 + - name: Create test structure file run: | cat > .structkit.yaml << 'EOF' @@ -64,6 +98,9 @@ jobs: - name: Checkout uses: actions/checkout@v7 + - name: Set up StructKit + uses: httpdss/structkit-setup@v0 + - name: Create test structure file run: | cat > .structkit.yaml << 'EOF' @@ -94,6 +131,11 @@ jobs: - name: Checkout uses: actions/checkout@v7 + - name: Set up StructKit from git + uses: httpdss/structkit-setup@v0 + with: + structkit-version: "https://github.com/httpdss/structkit.git@main" + - name: Create test structure file run: | cat > .structkit.yaml << 'EOF' @@ -102,12 +144,11 @@ jobs: content: "Testing version" EOF - - name: Run with git installation + - name: Run with git-installed StructKit uses: ./ with: command: validate struct_file: .structkit.yaml - structkit_version: "https://github.com/httpdss/structkit.git@main" test-validate-structkit-yaml-fixture: name: Test Validate .structkit.yaml Fixture @@ -116,6 +157,9 @@ jobs: - name: Checkout uses: actions/checkout@v7 + - name: Set up StructKit + uses: httpdss/structkit-setup@v0 + - name: Run validate with .structkit.yaml fixture uses: ./ with: @@ -129,6 +173,9 @@ jobs: - name: Checkout uses: actions/checkout@v7 + - name: Set up StructKit + uses: httpdss/structkit-setup@v0 + - name: Run validate with legacy .struct.yaml fixture uses: ./ with: @@ -142,6 +189,9 @@ jobs: - name: Checkout uses: actions/checkout@v7 + - name: Set up StructKit + uses: httpdss/structkit-setup@v0 + - name: Place .structkit.yaml at repo root run: cp tests/fixtures/structkit-yaml/.structkit.yaml .structkit.yaml @@ -157,6 +207,9 @@ jobs: - name: Checkout uses: actions/checkout@v7 + - name: Set up StructKit + uses: httpdss/structkit-setup@v0 + - name: Place legacy .struct.yaml at repo root run: cp tests/fixtures/legacy-struct-yaml/.struct.yaml .struct.yaml @@ -172,6 +225,9 @@ jobs: - name: Checkout uses: actions/checkout@v7 + - name: Set up StructKit + uses: httpdss/structkit-setup@v0 + - name: Place both default files at repo root run: | cp tests/fixtures/structkit-yaml/.structkit.yaml .structkit.yaml @@ -189,6 +245,9 @@ jobs: - name: Checkout uses: actions/checkout@v7 + - name: Set up StructKit + uses: httpdss/structkit-setup@v0 + - name: Run validate without config id: validate continue-on-error: true diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..b9a7fa1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,25 @@ +# Changelog + +All notable changes to this project are documented in this file. + +## Unreleased + +### Breaking changes + +- **This action no longer installs Python or StructKit.** It expects `structkit` to already be on `PATH`. +- Removed inputs `structkit_version` and `python_version`. +- Call [`httpdss/structkit-setup`](https://github.com/httpdss/structkit-setup) first when you need StructKit installed: + + ```yaml + - uses: httpdss/structkit-setup@v0 + - uses: httpdss/structkit-action@v0 + with: + command: validate + ``` + + If `structkit` is missing, the action fails with an error that points at `uses: httpdss/structkit-setup@v0`. +- Docs, examples, and CI pin the published major tags `@v0` (`httpdss/structkit-setup@v0`, then `httpdss/structkit-action@v0`). Show `structkit-version` on setup when you need a specific StructKit release. + +### License + +- Relicensed from MIT to Apache License 2.0. diff --git a/LICENSE b/LICENSE index 66f5f2f..d645695 100644 --- a/LICENSE +++ b/LICENSE @@ -1,21 +1,202 @@ -MIT License - -Copyright (c) 2026 Kenneth Belitzky - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 33871e7..17f714e 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ Companion to [StructKit](https://github.com/httpdss/structkit). Run `validate`, `generate`, or a dry-run drift check as a workflow step. Star the [core repo](https://github.com/httpdss/structkit). +**Breaking change:** this action no longer installs Python or StructKit. Add [`httpdss/structkit-setup@v0`](https://github.com/httpdss/structkit-setup) first (see [CHANGELOG](CHANGELOG.md)). + ## Features - 🔍 **Validate** structure definitions on every PR @@ -11,7 +13,7 @@ Companion to [StructKit](https://github.com/httpdss/structkit). Run `validate`, - 🔄 **Drift Detection** - detect when generated files don't match definitions - 🛡️ **Safe Defaults** - runs with `--no-hooks` and `--non-interactive` by default - 📦 **Custom Structures** - supports external structure repositories -- 🎯 **Flexible Versioning** - install from PyPI, git, or specific versions +- 🔧 **Bring your own StructKit** - install with [`httpdss/structkit-setup`](https://github.com/httpdss/structkit-setup) (or any other method) before this action runs ## Quick Start @@ -26,7 +28,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - - uses: httpdss/structkit-action@v1 + - uses: httpdss/structkit-setup@v0 + - uses: httpdss/structkit-action@v0 with: command: validate ``` @@ -44,7 +47,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - - uses: httpdss/structkit-action@v1 + - uses: httpdss/structkit-setup@v0 + - uses: httpdss/structkit-action@v0 with: command: generate dry_run: true @@ -66,8 +70,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 + - uses: httpdss/structkit-setup@v0 - - uses: httpdss/structkit-action@v1 + - uses: httpdss/structkit-action@v0 with: command: generate struct_file: .structkit.yaml @@ -93,13 +98,11 @@ jobs: | `diff` | Show diff of changes (use with dry_run for drift detection) | No | `false` | | `no_hooks` | Disable hooks during execution (requires StructKit >= 3.3.0) | No | `false` | | `non_interactive` | Run in non-interactive mode (check if your StructKit version supports this flag) | No | `false` | -| `structkit_version` | StructKit version to install (version number, `latest`, or git URL) | No | `latest` | | `structures_path` | Path to custom structures directory | No | `''` | | `structures_repository` | Custom structures repository to checkout (format: `owner/repo`) | No | `''` | | `structures_repository_path` | Path within structures_repository where structures are located | No | `structures` | | `structures_repository_ref` | Git ref (branch/tag/commit) to checkout from structures_repository | No | `main` | | `extra_args` | Additional arguments to pass to StructKit command | No | `''` | -| `python_version` | Python version to use | No | `3.x` | | `fail_on_diff` | Fail the action if changes would be made (drift detection) | No | `false` | ## Outputs @@ -116,39 +119,46 @@ jobs: This repository uses automated release management with semantic versioning: - **Release Drafting**: Releases are automatically drafted when PRs are merged to main -- **First Release**: Will be tagged as `v1.0.0` -- **Major Version Tags**: When a release like `v1.2.3` is published, the major tag `v1` is automatically created/moved to point to it +- **First Release**: Will be tagged as `v0.0.1` +- **Major Version Tags**: When a release like `v0.0.1` is published, the major tag `v0` is automatically created/moved to point to it - **Pinning Recommendations**: - - Use `@v1` to automatically get minor and patch updates (recommended for most users) - - Use `@v1.0.0` to pin to a specific version + - Use `@v0` to automatically get minor and patch updates (recommended for most users) + - Use `@v0.0.1` to pin to a specific version -The major version tag (`v1`) is maintained automatically, so users can always reference the latest stable v1.x.x release using `@v1`. +The major version tag (`v0`) is maintained automatically, so users can always reference the latest stable v0.x.x release using `@v0`. ## Advanced Examples -### Use Specific StructKit Version +### Pin the StructKit version + +Version selection lives in [`httpdss/structkit-setup`](https://github.com/httpdss/structkit-setup), not this action: ```yaml -- uses: httpdss/structkit-action@v1 +- uses: httpdss/structkit-setup@v0 + with: + structkit-version: "3.3.0" +- uses: httpdss/structkit-action@v0 with: command: validate - structkit_version: "1.2.3" ``` ### Install from Git ```yaml -- uses: httpdss/structkit-action@v1 +- uses: httpdss/structkit-setup@v0 + with: + structkit-version: "https://github.com/httpdss/structkit.git@main" +- uses: httpdss/structkit-action@v0 with: command: generate - structkit_version: "https://github.com/httpdss/structkit.git@main" ``` ### Use Custom Structures Repository ```yaml -- uses: httpdss/structkit-action@v1 +- uses: httpdss/structkit-setup@v0 +- uses: httpdss/structkit-action@v0 with: command: generate structures_repository: myorg/my-structures @@ -159,7 +169,8 @@ The major version tag (`v1`) is maintained automatically, so users can always re ### Generate with Extra Arguments ```yaml -- uses: httpdss/structkit-action@v1 +- uses: httpdss/structkit-setup@v0 +- uses: httpdss/structkit-action@v0 with: command: generate extra_args: "--verbose --force" @@ -168,7 +179,8 @@ The major version tag (`v1`) is maintained automatically, so users can always re ### Use Action Outputs ```yaml -- uses: httpdss/structkit-action@v1 +- uses: httpdss/structkit-setup@v0 +- uses: httpdss/structkit-action@v0 id: structkit with: command: generate @@ -196,7 +208,8 @@ jobs: - config/frontend.structkit.yaml steps: - uses: actions/checkout@v7 - - uses: httpdss/structkit-action@v1 + - uses: httpdss/structkit-setup@v0 + - uses: httpdss/structkit-action@v0 with: command: validate struct_file: ${{ matrix.struct_file }} @@ -217,7 +230,7 @@ If you need automatic PR creation, use the [reusable workflow](https://github.co ## Requirements -- Python 3.x (automatically installed by the action) +- `structkit` on `PATH` (install with [`httpdss/structkit-setup@v0`](https://github.com/httpdss/structkit-setup) first, or any other method) - GitHub Actions runner with bash support ## Configuration file @@ -230,11 +243,12 @@ This action is designed to work with different versions of StructKit. Some comma ## How It Works -1. **Setup** - Installs Python and StructKit -2. **Checkout** - Optionally checks out custom structures repository -3. **Execute** - Runs the specified StructKit command -4. **Outputs** - Provides execution results for downstream steps -5. **Cleanup** - Removes temporary files +1. **Require StructKit** - Fails with a clear error if `structkit` is not on `PATH` +2. **Resolve** - Auto-detects `.structkit.yaml` or legacy `.struct.yaml` unless `struct_file` is set +3. **Checkout** - Optionally checks out a custom structures repository +4. **Execute** - Runs the specified StructKit command +5. **Outputs** - Provides execution results for downstream steps +6. **Cleanup** - Removes temporary files ## Common Patterns @@ -251,7 +265,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - - uses: httpdss/structkit-action@v1 + - uses: httpdss/structkit-setup@v0 + - uses: httpdss/structkit-action@v0 with: command: validate ``` @@ -269,7 +284,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - - uses: httpdss/structkit-action@v1 + - uses: httpdss/structkit-setup@v0 + - uses: httpdss/structkit-action@v0 with: command: generate dry_run: true @@ -290,8 +306,9 @@ jobs: environment: production steps: - uses: actions/checkout@v7 + - uses: httpdss/structkit-setup@v0 - - uses: httpdss/structkit-action@v1 + - uses: httpdss/structkit-action@v0 with: command: generate @@ -307,15 +324,15 @@ jobs: ### Command Not Found -If `structkit` command is not found, ensure Python is properly set up: +This action does not install StructKit. Add setup first: ```yaml -- uses: actions/setup-python@v5 - with: - python-version: '3.x' -- uses: httpdss/structkit-action@v1 +- uses: httpdss/structkit-setup@v0 +- uses: httpdss/structkit-action@v0 ``` +Or install StructKit yourself (pip, uv, etc.) so `structkit` is on `PATH` before this step. + ### Permission Denied When using `structures_repository`, ensure your workflow has access: @@ -335,11 +352,12 @@ Contributions are welcome! Please feel free to submit a Pull Request. ## License -MIT License - see [LICENSE](LICENSE) file for details. +Apache License 2.0 - see [LICENSE](LICENSE). ## Related Projects - [StructKit](https://github.com/httpdss/structkit) - The main StructKit project +- [structkit-setup](https://github.com/httpdss/structkit-setup) - Install StructKit in GitHub Actions - [StructKit Reusable Workflow](https://github.com/httpdss/structkit/blob/main/.github/workflows/struct-generate.yaml) - Full workflow with PR creation ## Support diff --git a/action.yml b/action.yml index 16bea89..6c94c8e 100644 --- a/action.yml +++ b/action.yml @@ -34,10 +34,6 @@ inputs: description: 'Run in non-interactive mode (check if your StructKit version supports this flag)' required: false default: 'false' - structkit_version: - description: 'StructKit version to install (PyPI version number, "latest", or git URL)' - required: false - default: 'latest' structures_path: description: 'Path to custom structures directory (leave empty for default)' required: false @@ -58,10 +54,6 @@ inputs: description: 'Additional arguments to pass to StructKit command' required: false default: '' - python_version: - description: 'Python version to use' - required: false - default: '3.x' fail_on_diff: description: 'Fail the action if changes would be made (drift detection)' required: false @@ -84,6 +76,17 @@ outputs: runs: using: 'composite' steps: + - name: Require StructKit on PATH + shell: bash + run: | + if ! command -v structkit >/dev/null 2>&1; then + echo "::error::structkit is not on PATH. Add a prior step that installs it, for example:" + echo "::error:: uses: httpdss/structkit-setup@v0" + echo "::error::This action no longer installs Python or StructKit." + exit 1 + fi + echo "Using structkit at $(command -v structkit)" + - name: Resolve struct file id: resolve-struct-file shell: bash @@ -94,27 +97,6 @@ runs: echo "Using struct file: ${STRUCT_FILE}" echo "struct_file=${STRUCT_FILE}" >> "${GITHUB_OUTPUT}" - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ inputs.python_version }} - - - name: Install StructKit - shell: bash - run: | - if [[ "${{ inputs.structkit_version }}" == "latest" ]]; then - echo "Installing StructKit from PyPI (latest)" - pip install structkit - elif [[ "${{ inputs.structkit_version }}" == http* ]]; then - echo "Installing StructKit from git URL: ${{ inputs.structkit_version }}" - pip install "git+${{ inputs.structkit_version }}" - else - echo "Installing StructKit version: ${{ inputs.structkit_version }}" - pip install "structkit==${{ inputs.structkit_version }}" - fi - echo "StructKit installed successfully" - structkit --help > /dev/null - - name: Checkout custom structures repository if: inputs.structures_repository != '' uses: actions/checkout@v7 diff --git a/examples/README.md b/examples/README.md index 5c72f53..1685521 100644 --- a/examples/README.md +++ b/examples/README.md @@ -20,7 +20,8 @@ cp examples/validate-pr.yml .github/workflows/ ## Customization Tips -- Replace version pins (`@v1`) with specific commit SHAs for production use +- Add `httpdss/structkit-setup@v0` before this action so `structkit` is on `PATH` +- Replace version pins (`@v0`) with specific commit SHAs for production use - Adjust `struct_file` paths to match your repository structure (default is `.structkit.yaml`; legacy `.struct.yaml` is still auto-detected if you omit the input) - Configure branch names and PR settings according to your workflow - Add environment-specific secrets if using private structure repositories diff --git a/examples/custom-structures.yml b/examples/custom-structures.yml index eb7f303..9212da3 100644 --- a/examples/custom-structures.yml +++ b/examples/custom-structures.yml @@ -16,8 +16,11 @@ jobs: - name: Checkout code uses: actions/checkout@v7 + - name: Set up StructKit + uses: httpdss/structkit-setup@v0 + - name: Generate with custom structures - uses: httpdss/structkit-action@v1 + uses: httpdss/structkit-action@v0 with: command: generate struct_file: .structkit.yaml diff --git a/examples/drift-detection.yml b/examples/drift-detection.yml index 7e67a8a..d3f7c63 100644 --- a/examples/drift-detection.yml +++ b/examples/drift-detection.yml @@ -14,9 +14,12 @@ jobs: - name: Checkout code uses: actions/checkout@v7 + - name: Set up StructKit + uses: httpdss/structkit-setup@v0 + - name: Check for drift id: drift-check - uses: httpdss/structkit-action@v1 + uses: httpdss/structkit-action@v0 with: command: generate struct_file: .structkit.yaml diff --git a/examples/generate-and-commit.yml b/examples/generate-and-commit.yml index 530c43c..8533094 100644 --- a/examples/generate-and-commit.yml +++ b/examples/generate-and-commit.yml @@ -19,8 +19,11 @@ jobs: - name: Checkout code uses: actions/checkout@v7 + - name: Set up StructKit + uses: httpdss/structkit-setup@v0 + - name: Generate structure - uses: httpdss/structkit-action@v1 + uses: httpdss/structkit-action@v0 with: command: generate struct_file: ${{ github.event.inputs.struct_file || '.structkit.yaml' }} diff --git a/examples/scheduled-check.yml b/examples/scheduled-check.yml index 8f5fac9..3e0a411 100644 --- a/examples/scheduled-check.yml +++ b/examples/scheduled-check.yml @@ -14,10 +14,13 @@ jobs: - name: Checkout code uses: actions/checkout@v7 + - name: Set up StructKit + uses: httpdss/structkit-setup@v0 + - name: Check for drift id: drift continue-on-error: true - uses: httpdss/structkit-action@v1 + uses: httpdss/structkit-action@v0 with: command: generate struct_file: .structkit.yaml diff --git a/examples/validate-pr.yml b/examples/validate-pr.yml index adda388..ef2d7e4 100644 --- a/examples/validate-pr.yml +++ b/examples/validate-pr.yml @@ -16,8 +16,11 @@ jobs: - name: Checkout code uses: actions/checkout@v7 + - name: Set up StructKit + uses: httpdss/structkit-setup@v0 + - name: Validate structure - uses: httpdss/structkit-action@v1 + uses: httpdss/structkit-action@v0 with: command: validate struct_file: .structkit.yaml