Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Following the installation instructions does not work #1062

Closed
1 task done
onlywei opened this issue May 24, 2024 · 3 comments
Closed
1 task done

Following the installation instructions does not work #1062

onlywei opened this issue May 24, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@onlywei
Copy link

onlywei commented May 24, 2024

Description:
I may be fundamentally mis-understanding how to use this action. See this screenshot:
image

I found this action by clicking on

Action version:
4.0.2

Platform:

  • macOS

Runner type:
Irrelevant

Tools version:
Irrelevant

Repro steps:

  1. In a repo, click on Actions
  2. Click on "New Workflow"
  3. Click on "set up a workflow yourself"
  4. Find "Setup Node.js environment" in the right sidebar
  5. Follow the instructions, which say copy-paste the string into the yml file

Expected behavior:
No red squigglies.

Actual behavior:
Immediate red squigglies.

@onlywei onlywei added bug Something isn't working needs triage labels May 24, 2024
@aparnajyothi-y
Copy link
Contributor

Hello @onlywei, Thank you for creating this issue and we will look into it :)

@priyagupta108 priyagupta108 self-assigned this Jun 10, 2024
@priyagupta108
Copy link

Hello @onlywei 👋, thank you for reaching out.
It seems you're facing some syntax-related challenges while setting up a Node.js environment in GitHub Actions using a template from the GitHub Marketplace. It's important to note that these templates often include all possible usage scenarios and may need some adjustments to align with the correct YAML syntax.
Here are some steps to guide you through setting up a GitHub Actions workflow:

  1. Using the 'Actions' tab in your repository:
    • Click on the Actions tab.

    • Choose set up a workflow yourself if you want to create a custom workflow, you'll be redirected to an editor where you can write your workflow YAML file. Here, you can use the actions/setup-node@v4 action to set up your Node.js environment. You can also use pre-built actions from the GitHub Marketplace, which come with their own usage documentation. Please refer to this screenshot:

      Screenshot 2024-06-12 at 5 29 20 PM

    • Or you can select an existing Node.js workflow template. Here is the screenshot for your reference:

      Screenshot 2024-06-12 at 5 17 57 PM


2. Creating a .github/workflows directory in your repository:
Add a .yml or .yaml file under the .github/workflows directory in your repository. GitHub identifies this as a workflow file.

Here's a simplified example of how to use the actions/setup-node action in a workflow file:

name: CI
on: [push, pull_request]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Use Node.js
      uses: actions/setup-node@v4
      with:
        node-version: '20'
    - name: Install Dependencies
      run: npm install
    - name: Run Tests
      run: npm test

This workflow triggers on every push and pull request, sets up a Node.js environment with version 20, installs npm dependencies, and runs tests.
Please ensure proper spacing and indentation in your YAML files as they are sensitive to these.
For more information, you can refer to the "Building and testing Node.js" documentation.
Let me know if you have any further issues or questions.

@priyagupta108
Copy link

Hi @onlywei 👋,
I hope that the steps provided on how to use setup-node action were helpful. If you encounter any problems or need more assistance, please feel free to reach out. I am proceeding to close this issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants