Skip to content

Commit

Permalink
ci: add region metadata check (#8750)
Browse files Browse the repository at this point in the history
ref: DTCORE-130

Signed-off-by: Marie JONES <[email protected]>
  • Loading branch information
marie-j authored Jan 31, 2023
1 parent a9ce8a8 commit 2976a1d
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 1 deletion.
11 changes: 11 additions & 0 deletions .github/workflows/check-medata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Check package.json metadatas
on: [push]

jobs:
check-regions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Check regions metadata
run: ./scripts/regions/check-regions.sh
shell: bash
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.PHONY: test
test:
shellcheck scripts/release/release.sh
shellcheck scripts/release/release.sh scripts/regions/check-regions.sh
20 changes: 20 additions & 0 deletions scripts/regions/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Scripts: `check-regions`

> Check app package.json defines regions metadata
## Prerequisites

* shellcheck


## Usage

```sh
scripts/regions/check-regions
```

## Testing

```
make test
```
22 changes: 22 additions & 0 deletions scripts/regions/check-regions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

get_apps() {
ls 'packages/manager/apps'
}

get_package_json() {
app_path="$1"
cat packages/manager/apps/"$app_path"/package.json
}

main() {
apps=$(get_apps)
while read -r app; do
if ! get_package_json "$app" | grep -q "regions"; then
echo "Missing regions metadata in $app"
exit 1
fi
done<<<"$apps"
}

main "${@}"

0 comments on commit 2976a1d

Please sign in to comment.