Skip to content

Commit 540dc80

Browse files
authored
Lint match extension name and directory (#42)
* Lint match extension name and directory
1 parent 8d7445d commit 540dc80

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

.github/actions/lint-extension/action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ runs:
1111
using: "composite"
1212

1313
steps:
14+
- name: Check extension name matches directory
15+
run: |
16+
MANIFEST_NAME=$(jq -r '.extension.name' < ./extensions/${{ inputs.extension-name }}/manifest.json)
17+
if [ ${{ inputs.extension-name }} != $MANIFEST_NAME ]; then
18+
echo "Error: Extension name, directory, and manifest.json mismatch"
19+
echo "Extension '${{ inputs.extension-name }}' must be in the folder '/extensions/${{ inputs.extension-name }}'" and have the name '${{ inputs.extension-name }}' in the manifest.json.
20+
exit 1
21+
fi
22+
shell: bash
23+
1424
# Ensures that the manifest.json for the given extension name
1525
# contains all the required fields for the rest of the release workflow
1626
- run: |

.github/workflows/extensions.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ jobs:
2424
id: changes
2525
with:
2626
# Adding a new extension that has a directory that can be TARed?
27-
# Add a new line here with the name of the extension and directory path
28-
# Be sure the extension name and directory have the same name
27+
# Add a new line here with the name of the extension as the name of
28+
# the filter and the value as the extension's directory path
29+
# Be sure the extension name and directory name are the same
2930
# e.g. `extension-name: extensions/extension-name/**`
3031
filters: |
3132
reaper: extensions/reaper/**
@@ -76,8 +77,10 @@ jobs:
7677
pull-requests: read
7778
outputs:
7879
# Adding a new extension with a complex build process?
79-
# Add a new line here with the name of the extension step output variable below
80+
# Add a new line here with the name of the extension as the name of the
81+
# filter and the step output variable below
8082
# e.g. `extension-name: ${{ steps.changes.outputs.extension-name }}`
83+
# Be sure the extension name and directory name it is in are the same
8184
publisher-command-center: ${{ steps.changes.outputs.publisher-command-center }}
8285

8386
steps:

0 commit comments

Comments
 (0)