Bump js-yaml from 3.14.1 to 3.14.2 #209
This file contains hidden or 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 I18N | |
| on: | |
| push: | |
| paths: | |
| - '**.js' | |
| - '**/package.json' | |
| - 'package-lock.json' | |
| - 'web-stories.php' | |
| - 'includes/**.php' | |
| - '.github/workflows/lint-i18n.yml' | |
| branches: | |
| - main | |
| pull_request: | |
| paths: | |
| - '**.js' | |
| - '**/package.json' | |
| - 'package-lock.json' | |
| - 'web-stories.php' | |
| - 'includes/**.php' | |
| - '.github/workflows/lint-i18n.yml' | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Cancel previous | |
| uses: styfle/[email protected] | |
| with: | |
| access_token: ${{ github.token }} | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| # TODO: Switch to WP-CLI stable (wp-cli.phar) once 2.5.0 is out. | |
| - name: Install WP-CLI | |
| run: | | |
| curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli-nightly.phar | |
| mv wp-cli-nightly.phar wp-cli.phar | |
| chmod +x wp-cli.phar | |
| mkdir -p bin | |
| mv wp-cli.phar bin/wp | |
| echo "${PWD}/bin" >> $GITHUB_PATH | |
| - name: WP-CLI Info | |
| run: wp cli info | |
| - name: Read .nvmrc | |
| run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)" | |
| id: nvm | |
| - name: Setup Node | |
| uses: actions/[email protected] | |
| with: | |
| node-version: '${{ steps.nvm.outputs.NVMRC }}' | |
| - name: Cache node modules | |
| uses: pat-s/[email protected] | |
| with: | |
| # npm cache files are stored in `~/.npm` on Linux/macOS | |
| path: ~/.npm | |
| key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-build-${{ env.cache-name }}- | |
| ${{ runner.os }}-build- | |
| ${{ runner.os }}- | |
| env: | |
| cache-name: cache-node-modules | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '7.4' | |
| coverage: none | |
| tools: composer:v2.1.1 | |
| - name: Get Composer cache directory | |
| id: composer-cache | |
| run: echo "::set-output name=dir::$(composer config cache-files-dir)" | |
| - name: Setup Composer cache | |
| uses: pat-s/[email protected] | |
| with: | |
| path: ${{ steps.composer-cache.outputs.dir }} | |
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-composer- | |
| ${{ runner.os }}- | |
| - name: Install dependencies | |
| run: | | |
| npm ci | |
| composer install --prefer-dist --no-progress --no-interaction | |
| env: | |
| CI: true | |
| PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true | |
| - name: Build plugin | |
| run: npm run build:js | |
| - name: Bundle regular version | |
| run: npm run workflow:build-plugin | |
| # Check if as many strings as expected were found. | |
| # Fail job if `wp i18n make-pot` returns any warnings. | |
| # Some false positive warnings are removed due to a bug in the string extraction. | |
| # That's why this step is unfortunately a bit more complex. | |
| # See https://github.com/wp-cli/i18n-command/issues/154 | |
| - name: Generate POT file | |
| run: | | |
| OUTPUT=$((wp i18n make-pot build/web-stories build/web-stories.pot) 2>&1 >/dev/null) | |
| HAS_ERROR=false | |
| EXPECTED_NUMBER_OF_STRINGS=1000 | |
| NUMBER_OF_FOUND_STRINGS=$(grep -o msgstr build/web-stories.pot | wc -l | xargs) | |
| if (( "$NUMBER_OF_FOUND_STRINGS" < "$EXPECTED_NUMBER_OF_STRINGS" )); then | |
| HAS_ERROR=true | |
| echo "String extraction found only $NUMBER_OF_FOUND_STRINGS translatable strings. Expected at least $EXPECTED_NUMBER_OF_STRINGS." | |
| fi | |
| IFS=$'\n' | |
| declare -a WARNINGS=($OUTPUT) | |
| unset IFS | |
| for WARNING in "${WARNINGS[@]}"; do | |
| # Filter false positives. | |
| if [[ $WARNING == *"translator comment"* ]] && [[ $WARNING != *"%s"* ]]; then | |
| continue | |
| fi | |
| HAS_ERROR=true | |
| echo $WARNING | |
| done | |
| if [[ "$HAS_ERROR" = true ]]; then | |
| exit 1 | |
| fi |