Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/esmeta-installer/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: 'install esmeta'

runs:
using: "composite"
steps:
- name: setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: setup SBT
uses: sbt/setup-sbt@v1
- name: set esmeta version and path
shell: bash
run: |
echo "ESMETA_VERSION=v0.7.1" >> $GITHUB_ENV
echo "ESMETA_HOME=vendor/esmeta" >> $GITHUB_ENV
- name: clone esmeta
shell: bash
run: |
mkdir -p "${ESMETA_HOME}"
git clone --branch $ESMETA_VERSION --depth 1 https://github.com/es-meta/esmeta.git "${ESMETA_HOME}"
- name: build esmeta
shell: bash
run: |
cd "${ESMETA_HOME}"
sbt assembly
- name: link ecma262
shell: bash
run: |
rmdir "${ESMETA_HOME}"/ecma262 \
&& ln -s "$(pwd)" "${ESMETA_HOME}"/ecma262
31 changes: 3 additions & 28 deletions .github/workflows/esmeta-typecheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,11 @@ jobs:
esmeta-typecheck:
name: 'esmeta typecheck'
runs-on: ubuntu-22.04

env:
ESMETA_HOME: vendor/esmeta

steps:
- name: Checkout
- name: checkout
uses: actions/checkout@v4
- name: Setup JDK
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Setup SBT
uses: sbt/setup-sbt@v1
- name: download esmeta
run: |
mkdir -p "${ESMETA_HOME}"
cd "${ESMETA_HOME}"
git init
git remote add origin https://github.com/es-meta/esmeta.git
git fetch --depth 1 origin bd58590ef6badabbe71afdefa02dc32274902621 ;# v0.7.1
git checkout FETCH_HEAD
- name: build esmeta
run: |
cd "${ESMETA_HOME}"
sbt assembly
- name: link
run: |
rmdir "${ESMETA_HOME}"/ecma262 \
&& ln -s "$(pwd)" "${ESMETA_HOME}"/ecma262
- name: install esmeta
uses: ./.github/workflows/esmeta-installer
- name: typecheck
run: '"${ESMETA_HOME}"/bin/esmeta tycheck -status -extract:log -tycheck:log -tycheck:ignore=esmeta-ignore.json'
- name: create logs archive
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/esmeta-yetcheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: 'esmeta yet phrases detection'

on: [pull_request]

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: install esmeta
uses: ./.github/workflows/esmeta-installer
- 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: check for newly-introduced phrases
run: |
"${ESMETA_HOME}"/bin/esmeta extract \
-status \
-extract:warn-action <<< ${{ steps.collect.outputs.added_lines }}