Skip to content

Commit 25714d4

Browse files
authored
feat: add input to control version validation level (#25) [major]
* feat: add input to control version validation level Introduce the `validation-level` input, defaulting to `minor`. When `validation-level` is set to `minor`, the action truncates the current stable WordPress version (e.g., 6.5.3 becomes 6.5) before comparison. This ensures that validation passes if the plugin is tested up to the latest minor branch, regardless of subsequent patch releases. * enhance version validation logic to support 'patch' level * docs: update validation-level section in README.md for clarity * test both minor and patch validation levels * add more tests
1 parent 9cb142a commit 25714d4

File tree

13 files changed

+109
-5
lines changed

13 files changed

+109
-5
lines changed

.github/workflows/fixtures/plugin-test/README.md renamed to .github/workflows/fixtures/plugin-test-minor-fail/README.md

File renamed without changes.

.github/workflows/fixtures/plugin-test/plugin-test.php renamed to .github/workflows/fixtures/plugin-test-minor-fail/plugin-test.php

File renamed without changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
=== Plugin Test ===
2+
Contributors: jazzsequence
3+
Tags: github actions, testing
4+
Requires at least: 5.8
5+
Tested up to: 6.6
6+
Stable tag: 1.0.0
7+
License: MIT
8+
License URI: https://opensource.org/licenses/MIT
9+
10+
This is a test plugin for testing GitHub Actions workflows.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Plugin Test
2+
Contributors: jazzsequence
3+
Tags: github actions, testing
4+
Requires at least: 5.8
5+
Tested up to: 6.6.1
6+
Stable tag: 1.0.0
7+
License: MIT
8+
License URI: https://opensource.org/licenses/MIT
9+
10+
This is a test plugin for testing GitHub Actions workflows.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
/**
3+
* Plugin Name: Test Plugin
4+
* Plugin URI: https://github.com/jazzsequence/action-validate-plugin-version
5+
* Description: A test plugin for the GitHub Action to validate plugin version
6+
* Version: 1.0.0
7+
* Author: Chris Reynolds
8+
* Author URI: https://chrisreynolds.io
9+
* License: MIT License
10+
*/
11+
12+
// Silence is golden.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
=== Plugin Test ===
2+
Contributors: jazzsequence
3+
Tags: github actions, testing
4+
Requires at least: 5.8
5+
Tested up to: 6.8
6+
Stable tag: 1.0.0
7+
License: MIT
8+
License URI: https://opensource.org/licenses/MIT
9+
10+
This is a test plugin for testing GitHub Actions workflows.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Plugin Test
2+
Contributors: jazzsequence
3+
Tags: github actions, testing
4+
Requires at least: 5.8
5+
Tested up to: 6.6.1
6+
Stable tag: 1.0.0
7+
License: MIT
8+
License URI: https://opensource.org/licenses/MIT
9+
10+
This is a test plugin for testing GitHub Actions workflows.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
/**
3+
* Plugin Name: Test Plugin
4+
* Plugin URI: https://github.com/jazzsequence/action-validate-plugin-version
5+
* Description: A test plugin for the GitHub Action to validate plugin version
6+
* Version: 1.0.0
7+
* Author: Chris Reynolds
8+
* Author URI: https://chrisreynolds.io
9+
* License: MIT License
10+
*/
11+
12+
// Silence is golden.

.github/workflows/fixtures/plugin-test/readme.txt renamed to .github/workflows/fixtures/plugin-test-patch-fail/readme.txt

File renamed without changes.

.github/workflows/test.yml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,26 @@ on: [push, pull_request]
33
jobs:
44
test:
55
runs-on: ubuntu-latest
6+
name: Test Validation Level
67
steps:
78
- uses: actions/checkout@v5
89
with:
910
fetch-depth: 0
10-
- name: Validate Plugin Version
11+
- name: Validate Plugin Version (Patch - Fail)
1112
uses: ./
1213
with:
13-
plugin-path: '.github/workflows/fixtures/plugin-test/'
14-
dry-run: true
14+
plugin-path: '.github/workflows/fixtures/plugin-test-patch-fail/'
15+
dry-run: true
16+
validation-level: patch
17+
- name: Validate Plugin Version (Minor - Fail)
18+
uses: ./
19+
with:
20+
plugin-path: '.github/workflows/fixtures/plugin-test-minor-fail/'
21+
dry-run: true
22+
validation-level: minor
23+
- name: Validate Plugin Version (Minor - Pass)
24+
uses: ./
25+
with:
26+
plugin-path: '.github/workflows/fixtures/plugin-test-minor-pass/'
27+
dry-run: true
28+
validation-level: minor

0 commit comments

Comments
 (0)