Meta: add yet phrase checking using ESMeta #3
Workflow file for this run
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: 'esmeta yet phrases detection' | |
| on: | |
| pull_request: | |
| types: [opened, synchronize] | |
| jobs: | |
| esmeta-yetcheck: | |
| name: 'esmeta yet phrases detection' | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: list added line numbers | |
| id: collect | |
| shell: bash | |
| env: | |
| FILE_PATH: spec.html | |
| BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| HEAD_SHA: ${{ github.sha }} | |
| run: | | |
| # zero-context diff, limited to the file we care about | |
| added_lines=$(git diff -U0 --no-color "${BASE_SHA}" "${HEAD_SHA}" -- "${FILE_PATH}" | | |
| # keep only the hunk headers (the @@ lines) | |
| awk ' | |
| # Example header: @@ -158,0 +159,2 @@ | |
| /^@@/ { | |
| # Extract “+<start>[,<count>]” part | |
| match($0, /\+([0-9]+)(,([0-9]+))?/, a) | |
| start = a[1] | |
| count = (a[3] == "" ? 1 : a[3]) | |
| # Print every line number in the added range | |
| for (i = 0; i < count; i++) print start + i | |
| } | |
| ') | |
| # Join line numbers with comma or space (whichever format you need) | |
| added_joined=$(echo "$added_lines" | paste -sd "," -) | |
| added_lines_json="[$added_joined]" | |
| # Set it as an output value | |
| echo "added_lines=$added_lines_json" >> "$GITHUB_OUTPUT" | |
| - name: install esmeta | |
| uses: ./.github/workflows/esmeta-installer | |
| - name: check newly introduces phrases | |
| run: | | |
| "${ESMETA_HOME}"/bin/esmeta extract \ | |
| -status \ | |
| -extract:warn-action <<< ${{ steps.collect.outputs.added_lines }} |