05_03-develop-a-javascript-action
Use these files to test a JavaScript action.
From the GitHub Console...
- Create a new repo.
- Select
Node
when prompted to add a.gitignore
file or upload the ignore file in the next step. - 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. - Edit the file
dist_index.js
and rename it todist/index.js
. Essentially, you are replacing the_
in the name with a/
. That will rename the file toindex.js
and also move it into a directory nameddist
. - NOTE: The previous step is key for the workflow to complete successfully.
- Optionally, edit the file
package.json
and replace all occurences ofYOUR_GITHUB_USER_NAME
with your GitHub user name. - 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.
- Replace all occurences of
- NOTE: The previous step is key for the workflow to complete successfully.
- Once the workflow file is commited, the workflow should be triggered by a
push
event. - Confirm the
Hello Universe
workflow runs as expected and includes the outputHello, Universe!
.
From Your Local System...
- Create a new repo and clone it to your local system.
- 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. - 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
- To allow files in the
- Edit the file
package.json
and replace all occurences ofYOUR_GITHUB_USER_NAME
with your GitHub user name. - 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.
- Replace all occurences of
- NOTE: The previous step is key for the workflow to complete successfully.
- 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
- Commit the changes and push them to your repo.
- Once the commit is pushed, the workflow should be triggered by a
push
event. - Confirm the
Hello Universe
workflow runs as expected and includes the outputHello, Universe!
.