chadelofson / 05_03-develop-a-javascript-action

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

05_03-develop-a-javascript-action

Use these files to test a JavaScript action.

From the GitHub Console...

  1. Create a new repo.
  2. Select Node when prompted to add a .gitignore file or upload the ignore file in the next step.
  3. Add the exercise files to the root of the new repo. Be sure to add the file named .gitignore but note that it may be hidden.
  4. Edit the file dist_index.js and rename it to dist/index.js. Essentially, you are replacing the _ in the name with a /. That will rename the file to index.js and also move it into a directory named dist.
  5. NOTE: The previous step is key for the workflow to complete successfully.
  6. Optionally, edit the file package.json and replace all occurences of YOUR_GITHUB_USER_NAME with your GitHub user name.
  7. Edit the file hello-universe.yml and complete the following steps:
    • Replace all occurences of YOUR_GITHUB_USER_NAME with your GitHub user name.
    • Replace all occurences of YOUR_GITHUB_REPO_NAME with the name of the repo.
    • Rename the file to move it into the .github/workflows directory.
    • Commit the changes.
  8. NOTE: The previous step is key for the workflow to complete successfully.
  9. Once the workflow file is commited, the workflow should be triggered by a push event.
  10. Confirm the Hello Universe workflow runs as expected and includes the output Hello, Universe!.

From Your Local System...

  1. Create a new repo and clone it to your local system.
  2. Add the exercise files to the root of the new repo. Be sure to add the file named .gitignore but note that it may be hidden.
  3. NOTE: The .gitignore file from the previous step needs to be in place for the following reasons:
    • To allow files in the dist directory to be added to the repo
    • To prevent the node_modules directory from being added to the repo
  4. Edit the file package.json and replace all occurences of YOUR_GITHUB_USER_NAME with your GitHub user name.
  5. Edit the file hello-universe.yml and complete the following steps:
    • Replace all occurences of YOUR_GITHUB_USER_NAME with your GitHub user name.
    • Replace all occurences of YOUR_GITHUB_REPO_NAME with the name of the repo.
  6. NOTE: The previous step is key for the workflow to complete successfully.
  7. In the root of your repo, run the following commands:
    mkdir -p .github/workflows
    mv hello-universe.yml .github/workflows
    npm install -g @vercel/ncc
    npm init --yes
    npm install @actions/core
    npm install @actions/github
    npm run build
    npm run test
    
  8. Commit the changes and push them to your repo.
  9. Once the commit is pushed, the workflow should be triggered by a push event.
  10. Confirm the Hello Universe workflow runs as expected and includes the output Hello, Universe!.

About


Languages

Language:JavaScript 100.0%