Skip to content

Commit a6bb01e

Browse files
committed
Extract scripts from workflows
1 parent c8984e7 commit a6bb01e

4 files changed

Lines changed: 32 additions & 50 deletions

File tree

.github/verify-artifacts.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
dev=$(grep --color=always "devClone\|devExport\|(()=>{})" $(find extension-dist -name "*.js"))
4+
if [ -n "$dev" ]; then
5+
echo "::group::Invalid statements"
6+
echo "$dev"
7+
echo "::endgroup::"
8+
echo "::error ::Found statements that shouldn't be in the production build!"
9+
exit 1
10+
fi
11+
exit 0

.github/verify-dirs.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
3+
locales=$(find extension-dist/_locales -not -name "*.json" -type f)
4+
scripts=$(find extension-dist/scripts -not -name "*.js" -type f)
5+
styles=$(find extension-dist/styles -not -name "*.css" -not -name "*.woff2" -type f)
6+
if [ -n "$locales" ] || [ -n "$scripts" ] || [ -n "$styles" ]; then
7+
echo "::group::Files found"
8+
echo -e "\nIn _locales"
9+
echo "$locales"
10+
echo -e "\nIn scripts"
11+
echo "$scripts"
12+
echo -e "\nIn styles"
13+
echo "$styles"
14+
echo "::endgroup::"
15+
echo "::error ::Found files that do not belong!"
16+
exit 1
17+
fi

.github/workflows/node.js.pr.yml

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -122,15 +122,7 @@ jobs:
122122
env:
123123
YT_API_KEY: ${{ secrets.YOUTUBE_KEY }}
124124
- name: Verify no debug artifacts
125-
run: |
126-
dev=$(grep --color=always "devClone\|devExport\|(()=>{})" $(find extension-dist -name "*.js") || echo "")
127-
if [ -n "$dev" ]; then
128-
echo "::group::Invalid statements"
129-
echo "$dev"
130-
echo "::endgroup::"
131-
echo "::error ::Found statements that shouldn't be in the production build!"
132-
exit 1
133-
fi
125+
run: chmod +x .github/verify-artifacts.sh && .github/verify-artifacts.sh
134126
shell: bash
135127
- name: Run addon linter on non-minified
136128
run: npm run lint:ext
@@ -143,22 +135,7 @@ jobs:
143135
extension-dist/
144136
145137
- name: Verify directory structure
146-
run: |
147-
locales=$(find extension-dist/_locales -not -name "*.json" -type f)
148-
scripts=$(find extension-dist/scripts -not -name "*.js" -type f)
149-
styles=$(find extension-dist/styles -not -name "*.css" -not -name "*.woff2" -type f)
150-
if [ -n "$locales" ] || [ -n "$scripts" ] || [ -n "$styles" ]; then
151-
echo "::group::Files found"
152-
echo -e "\nIn _locales"
153-
echo "$locales"
154-
echo -e "\nIn scripts"
155-
echo "$scripts"
156-
echo -e "\nIn styles"
157-
echo "$styles"
158-
echo "::endgroup::"
159-
echo "::error ::Found files that do not belong!"
160-
exit 1
161-
fi
138+
run: chmod +x .github/verify-dirs.sh && .github/verify-dirs.sh
162139
shell: bash
163140
- name: Run linters
164141
run: npm run lint

.github/workflows/node.js.yml

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -239,15 +239,7 @@ jobs:
239239
env:
240240
YT_API_KEY: ${{ secrets.YOUTUBE_KEY }}
241241
- name: Verify no debug artifacts
242-
run: |
243-
dev=$(grep --color=always "devClone\|devExport\|(()=>{})" $(find extension-dist -name "*.js") || echo "")
244-
if [ -n "$dev" ]; then
245-
echo "::group::Invalid statements"
246-
echo "$dev"
247-
echo "::endgroup::"
248-
echo "::error ::Found statements that shouldn't be in the production build!"
249-
exit 1
250-
fi
242+
run: chmod +x .github/verify-artifacts.sh && .github/verify-artifacts.sh
251243
shell: bash
252244
- name: Run addon linter on non-minified
253245
run: npm run lint:ext
@@ -260,22 +252,7 @@ jobs:
260252
extension-dist/
261253
262254
- name: Verify directory structure
263-
run: |
264-
locales=$(find extension-dist/_locales -not -name "*.json" -type f)
265-
scripts=$(find extension-dist/scripts -not -name "*.js" -type f)
266-
styles=$(find extension-dist/styles -not -name "*.css" -not -name "*.woff2" -type f)
267-
if [ -n "$locales" ] || [ -n "$scripts" ] || [ -n "$styles" ]; then
268-
echo "::group::Files found"
269-
echo -e "\nIn _locales"
270-
echo "$locales"
271-
echo -e "\nIn scripts"
272-
echo "$scripts"
273-
echo -e "\nIn styles"
274-
echo "$styles"
275-
echo "::endgroup::"
276-
echo "::error ::Found files that do not belong!"
277-
exit 1
278-
fi
255+
run: chmod +x .github/verify-dirs.sh && .github/verify-dirs.sh
279256
shell: bash
280257
- name: Run linters
281258
run: npm run lint

0 commit comments

Comments
 (0)