Update the actions' version #43
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint | |
on: [pull_request] | |
env: | |
PLUGIN_NAME: dashboards-reporting | |
OPENSEARCH_DASHBOARDS_VERSION: "2.x" | |
jobs: | |
build: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout OpenSearch Dashboards | |
uses: actions/checkout@v4 | |
with: | |
repository: opensearch-project/Opensearch-Dashboards | |
ref: ${{ env.OPENSEARCH_DASHBOARDS_VERSION }} | |
path: OpenSearch-Dashboards | |
- name: Checkout dashboards reporting | |
uses: actions/checkout@v4 | |
with: | |
path: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} | |
fetch-depth: 0 | |
- 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@v4 | |
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/${{ env.PLUGIN_NAME }} | |
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: | | |
jq -r '.[]' ${HOME}/files_modified.json ${HOME}/files_added.json | sort | uniq > /tmp/changed_files.txt | |
CHANGED_FILES=$(cat /tmp/changed_files.txt) | |
echo "These are the changed files: $CHANGED_FILES" | |
if [[ -n "$CHANGED_FILES" ]]; then | |
echo "Linting changed files..." | |
while IFS= read -r file; do | |
if [[ $file == *.js || $file == *.ts || $file == *.tsx ]]; then | |
echo "linting file $file" | |
yarn lint "$file" | |
fi | |
done < /tmp/changed_files.txt | |
else | |
echo "No matched files to lint." | |
fi | |
working-directory: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }} |