name: "Setup node with debug support"
description: "Setup the nodejs version with debug support"
runs:
  using: "composite"
  steps:
    # For now we only have the Node 20 debug build
    - run: |
        sudo apt-get install unzip && curl -L "https://drive.google.com/uc?export=download&id=1hlhbbQi-NJi8_WjULvOdo-K_tfZFzN3Z&confirm=t" > nodejs.zip && unzip nodejs.zip
        sudo cp -f node /usr/bin/node-with-debug
        sudo chmod +x /usr/bin/node-with-debug
      shell: sh

    # List of naming patterns
    # https://man7.org/linux/man-pages/man5/core.5.html
    - run: |
        sudo mkdir -p /cores
        sudo sh -c "echo /cores/core-%e-%s-%u-%g-%p-%t > /proc/sys/kernel/core_pattern"
      shell: sh

    - run: |
        echo $(/usr/bin/node-with-debug --print "process.version")
        echo $(/usr/bin/node-with-debug --print "process.features.debug")
      shell: sh
