Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade the get-plugin-releases action to use Node.js v20 #119

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions packages/github-actions/actions/get-plugin-releases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,33 @@ jobs:
steps:
- name: Get Release versions from WooCommerce
id: wc-versions
uses: woocommerce/grow/get-plugin-releases@actions-v1
uses: woocommerce/grow/get-plugin-releases@actions-v2
with:
slug: woocommerce

- name: Get Release versions from WordPress
id: wp-versions
uses: woocommerce/grow/get-plugin-releases@actions-v1
uses: woocommerce/grow/get-plugin-releases@actions-v2
with:
slug: wordpress

- name: Get Release versions from GLA
id: gla-versions
uses: woocommerce/grow/get-plugin-releases@actions-v1
uses: woocommerce/grow/get-plugin-releases@actions-v2
with:
slug: google-listings-and-ads

- name: Get L-3 Release versions from WC including RC
id: wc-versions-l3-rc
uses: woocommerce/grow/get-plugin-releases@actions-v1
uses: woocommerce/grow/get-plugin-releases@actions-v2
with:
slug: woocommerce
releases: 4
includeRC: true

- name: Get L-2 Release versions from WC including patches
id: wc-versions-patches
uses: woocommerce/grow/get-plugin-releases@actions-v1
uses: woocommerce/grow/get-plugin-releases@actions-v2
with:
slug: woocommerce
includePatches: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ outputs:
description: The versions array in the format ["7.4","7.5","7.6"]

runs:
using: node16
using: node20
main: get-plugin-releases.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ import core from '@actions/core';
/**
* Internal dependencies
*/
import handleActionErrors from '../../../utils/handle-action-errors';
import handleActionErrors from '../../../utils/handle-action-errors.js';

async function getPluginReleases() {
const slug = getInput( 'slug' );
const apiEndpoint = getAPIEndpoint( slug );
async function getPluginReleases( inputs ) {
const apiEndpoint = getAPIEndpoint( inputs.slug );

return fetch( apiEndpoint )
.then( ( res ) => res.json() )
.then( parsePluginVersions );
.then( ( data ) => parsePluginVersions( data, inputs ) );
}

function getAPIEndpoint( slug ) {
Expand Down Expand Up @@ -43,12 +42,8 @@ function setOutput( key, value ) {
core.setOutput( key, value );
}

function parsePluginVersions( releases = {} ) {
const slug = getInput( 'slug' );
const numberOfReleases = parseInt( getInput( 'releases' ), 10 );
const includeRC = getInput( 'includeRC' );
const includePatches = getInput( 'includePatches' );

function parsePluginVersions( releases = {}, inputs ) {
const { slug, numberOfReleases, includeRC, includePatches } = inputs;
const output = [];

if ( slug !== 'wordpress' ) {
Expand Down Expand Up @@ -135,6 +130,16 @@ function semverCompare( a, b ) {
);
}

getPluginReleases()
.then( () => core.info( 'Finish getting the release versions.' ) )
.catch( handleActionErrors );
// Directly perform this action if it's running in GitHub Actions.
if ( process.env.GITHUB_ACTIONS ) {
const inputs = {
slug: getInput( 'slug' ),
numberOfReleases: parseInt( getInput( 'releases' ), 10 ),
includeRC: getInput( 'includeRC' ),
includePatches: getInput( 'includePatches' ),
};

getPluginReleases( inputs )
.then( () => core.info( 'Finish getting the release versions.' ) )
.catch( handleActionErrors );
}
Loading