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

Fix error in "update extension list" workflow #665

Merged
merged 3 commits into from
Feb 10, 2025
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
9 changes: 4 additions & 5 deletions .github/workflows/update_extension_list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ jobs:
update_extension_list:
runs-on: ubuntu-latest
steps:
- name: Install MATLAB
uses: matlab-actions/setup-matlab@v2

# Use deploy key to push back to protected branch
- name: Checkout repository using deploy key
uses: actions/checkout@v4
with:
ref: refs/heads/main
ssh-key: ${{ secrets.DEPLOY_KEY }}

- name: Install MATLAB
uses: matlab-actions/setup-matlab@v2

- name: Update extension list in nwbInstallExtensions
uses: matlab-actions/run-command@v2
with:
Expand All @@ -37,7 +37,6 @@ jobs:
set -e # Exit script on error
git config user.name "${{ github.workflow }} by ${{ github.actor }}"
git config user.email "<>"
git pull --rebase # Ensure the branch is up-to-date

if [[ -n $(git status --porcelain nwbInstallExtension.m) ]]; then
git add nwbInstallExtension.m
Expand All @@ -46,4 +45,4 @@ jobs:
else
echo "Nothing to commit"
fi


22 changes: 12 additions & 10 deletions resources/function_templates/nwbInstallExtension.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
function nwbInstallExtension(extensionNames, options)
% nwbInstallExtension - Installs a specified NWB extension.
% NWBINSTALLEXTENSION - Installs a specified NWB extension.
%
% Usage:
% nwbInstallExtension(extensionNames) installs Neurodata Without Borders
% (NWB) extensions to extend the functionality of the core NWB schemas.
% extensionNames is a scalar string or a string array, containing the name
% of one or more extensions from the Neurodata Extensions Catalog
% Syntax:
% NWBINSTALLEXTENSION(extensionNames) installs Neurodata Without Borders
% (NWB) extensions to extend the functionality of the core NWB schemas.
% extensionNames is a scalar string or a string array, containing the name
% of one or more extensions from the Neurodata Extensions Catalog
%
% Valid Extension Names (from https://nwb-extensions.github.io):
{{extensionNamesDoc}}
%
% Example:
% % Install the "ndx-miniscope" extension
% nwbInstallExtension("ndx-miniscope")
% Usage:
% Example 1 - Install "ndx-miniscope" extension::
%
% nwbInstallExtension("ndx-miniscope")
%
% See also:
% matnwb.extension.listExtensions, matnwb.extension.installExtension
Expand All @@ -27,7 +28,8 @@ function nwbInstallExtension(extensionNames, options)
if isempty(extensionNames)
T = matnwb.extension.listExtensions();
extensionList = join( compose(" %s", [T.name]), newline );
error("Please specify the name of an extension. Available extensions:\n\n%s\n", extensionList)
error('NWB:InstallExtension:MissingArgument', ...
'Please specify the name of an extension. Available extensions:\n\n%s\n', extensionList)
else
for extensionName = extensionNames
matnwb.extension.installExtension(extensionName, 'savedir', options.savedir)
Expand Down
3 changes: 1 addition & 2 deletions tools/maintenance/matnwb_createNwbInstallExtension.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ function matnwb_createNwbInstallExtension()
extensionNamesStr = compose("%s""%s""", indentStr, extensionNames);
extensionNamesStr = strjoin(extensionNamesStr, ", ..." + newline);
fcnStr = replace(fcnTemplate, "{{extensionNames}}", extensionNamesStr);

extensionNamesStr = compose("%% - ""%s""", extensionNames);
extensionNamesStr = strjoin(extensionNamesStr, newline);
fcnStr = replace(fcnStr, "{{extensionNamesDoc}}", extensionNamesStr);


fid = fopen(fullfile(matnwbRootDir, 'nwbInstallExtension.m'), "wt");
fwrite(fid, fcnStr);
fclose(fid);
Expand Down