A GitHub Action that fetches the last N number of WordPress versions from the WordPress API and sets them as output.
Optional The number of WordPress versions to fetch. Default is 3.
A JSON array containing the WordPress versions (e.g., ["6.4", "6.3", "6.2"]).
- name: Get WordPress Versions
id: wp-versions
uses: alleyinteractive/action-get-wordpress-versions@v1
- name: Use the versions
run: |
echo "WordPress versions: ${{ steps.wp-versions.outputs.versions }}"- name: Get WordPress Versions
id: wp-versions
uses: alleyinteractive/action-get-wordpress-versions@v1
with:
number: 5
- name: Use the versions
run: |
echo "WordPress versions: ${{ steps.wp-versions.outputs.versions }}"jobs:
get-versions:
runs-on: ubuntu-latest
outputs:
versions: ${{ steps.wp-versions.outputs.versions }}
steps:
- name: Get WordPress Versions
id: wp-versions
uses: alleyinteractive/action-get-wordpress-versions@v1
with:
number: 3
test:
needs: get-versions
runs-on: ubuntu-latest
strategy:
matrix:
wp-version: ${{ fromJson(needs.get-versions.outputs.versions) }}
steps:
- name: Test with WordPress ${{ matrix.wp-version }}
run: echo "Testing with WordPress version ${{ matrix.wp-version }}"- Fetches data from the WordPress Core Version Check API (
https://api.wordpress.org/core/version-check/1.7/) - Filters for versions marked as "autoupdate"
- Removes duplicate versions and sorts them in descending order (newest first)
- Takes the requested number of versions
- Strips patch versions (e.g.,
6.4.1becomes6.4) - Returns the versions as a JSON array
The GNU General Public License (GPL) license. Please see License File for more information.⏎