diff --git a/.github/workflows/update-test426-fixtures.yml b/.github/workflows/update-test426-fixtures.yml new file mode 100644 index 00000000000000..8fe01d578e9a32 --- /dev/null +++ b/.github/workflows/update-test426-fixtures.yml @@ -0,0 +1,35 @@ +name: test426 fixtures update + +on: + schedule: + - cron: 0 0 * * 0 + workflow_dispatch: + +permissions: + contents: read + +jobs: + update-test426-fixtures: + if: github.repository == 'nodejs/node' || github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0 + with: + persist-credentials: false + + - name: Update test426 fixtures from tc39/source-map-tests + run: bash tools/dep_updaters/update-test426-fixtures.sh + + - name: Open or update PR for test426 fixtures + uses: gr2m/create-or-update-pull-request-action@77596e3166f328b24613f7082ab30bf2d93079d5 + with: + branch: actions/update-test426-fixtures + author: Node.js GitHub Bot + title: 'test: update test426 fixtures from tc39/source-map-tests' + commit-message: 'test: update test426 fixtures from tc39/source-map-tests' + labels: test + update-pull-request-title-and-body: true + body: | + This is an automated update of the test426 fixtures from https://github.com/tc39/source-map-tests. + env: + GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }} diff --git a/tools/dep_updaters/update-test426-fixtures.sh b/tools/dep_updaters/update-test426-fixtures.sh new file mode 100755 index 00000000000000..184ace8c40bfa0 --- /dev/null +++ b/tools/dep_updaters/update-test426-fixtures.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +set -e + +BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) + +TARGET_DIR="$BASE_DIR/test/fixtures/test426" +README="$BASE_DIR/test/test426/README.md" +TARBALL_URL=$(curl -fsIo /dev/null -w '%header{Location}' https://github.com/tc39/source-map-tests/archive/HEAD.tar.gz) +SHA=$(basename "$TARBALL_URL") + +TMP_DIR="$(mktemp -d)" + +rm -rf "$TARGET_DIR" +mkdir "$TARGET_DIR" +curl -f "$TARBALL_URL" | tar -xz --strip-components 1 -C "$TARGET_DIR" + +rm -rf "$TMP_DIR" + +TMP_FILE=$(mktemp) +sed "s#https://github.com/tc39/source-map-tests/commit/[0-9a-f]*#https://github.com/tc39/source-map-tests/commit/$SHA#" "$README" > "$TMP_FILE" +mv "$TMP_FILE" "$README" + +echo "test426 fixtures updated to $SHA."