-
Notifications
You must be signed in to change notification settings - Fork 43
72 lines (60 loc) · 2.57 KB
/
lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Lint
on: [pull_request]
env:
PLUGIN_NAME: dashboards-visualizations
OPENSEARCH_DASHBOARDS_VERSION: "main"
jobs:
build:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout OpenSearch Dashboards
uses: actions/checkout@v2
with:
repository: opensearch-project/Opensearch-Dashboards
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }}
path: OpenSearch-Dashboards
- name: Checkout Plugin
uses: actions/checkout@v2
with:
path: OpenSearch-Dashboards/plugins/dashboards-visualizations
- name: Get node and yarn versions
working-directory: ${{ env.WORKING_DIR }}
id: versions_step
run: |
echo "::set-output name=node_version::$(cat ./OpenSearch-Dashboards/.nvmrc | cut -d"." -f1)"
echo "::set-output name=yarn_version::$(node -p "(require('./OpenSearch-Dashboards/package.json').engines.yarn).match(/[.0-9]+/)[0]")"
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ steps.versions_step.outputs.node_version }}
registry-url: "https://registry.npmjs.org"
- name: Install correct yarn version for OpenSearch Dashboards
run: |
npm uninstall -g yarn
echo "Installing yarn ${{ steps.versions_step.outputs.yarn_version }}"
npm i -g yarn@${{ steps.versions_step.outputs.yarn_version }}
- name: Bootstrap the plugin
working-directory: OpenSearch-Dashboards/plugins/dashboards-visualizations
run: yarn osd bootstrap --single-version=loose
- name: Get list of changed files using GitHub Action
uses: lots0logs/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Check Changes of Files
run: |
echo "FILES_MODIFIED=$(cat ${HOME}/files_modified.json)"
echo "FILES_ADDED=$(cat ${HOME}/files_added.json)"
echo "FILES_RENAMED=$(cat ${HOME}/files_renamed.json)"
echo "FILES_DELETED=$(cat ${HOME}/files_deleted.json)"
- name: Lint Changed Files
run: |
CHANGED_FILES=($(jq -r '.[]' ${HOME}/files_modified.json ${HOME}/files_added.json | grep '.\+.\(js\|ts\|tsx\)$' | sort -u))
if [[ -n "$CHANGED_FILES" ]]; then
echo 'These are the changed files:'
printf '%s\n' "${CHANGED_FILES[@]}"
yarn lint "${CHANGED_FILES[@]}"
else
echo "No matched files to lint."
fi
working-directory: OpenSearch-Dashboards/plugins/dashboards-visualizations