- Notifications
You must be signed in to change notification settings - Fork25
Create a JavaScript Action with tests, linting, workflow, publishing, and versioning. An opinionated alternative template to actions/javascript-action to bootstrap the creation of a JavaScript action. 🚀
License
github-developer/javascript-action
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
An opinionated alternative template to
actions/javascript-action
to bootstrap the creation of a JavaScript action. 🚀
Use this template to bootstrap the creation of a JavaScript action. 🚀 Alternative toactions/javascript-action
.
This template includesrelease automation,tests, linting, publishing, starter docs, and versioning guidance.
Reference the publishedsemantic tag, e.g. major:
uses:github-developer/javascript-action@v1with:milliseconds:1000
or minor:
uses:github-developer/javascript-action@v1.0with:milliseconds:1000
or patch:
uses:github-developer/javascript-action@v1.0.0with:milliseconds:1000
See theactions tab for runs of this action! 🚀
action.yml
defines the inputs and output for your action.
Update the action.yml with your name, description, inputs and outputs for your action.
See thedocumentation.
Most toolkit and CI/CD operations involve async operations so the action is run in an async function.
constcore=require('@actions/core');...asyncfunctionrun(){try{ ...}catch(error){core.setFailed(error.message);}}run()
See thetoolkit documentation for the various packages.
Jest andNock are included as suggestions for test and mocking frameworks.
A sampleUnit Test workflow is provided which runs on every pull request and push to themain
branch.
The entrypoint to your action is defined byruns.using
inaction.yml
.
This project uses aprepare
script leveraging@vercel/ncc
to compile and package the code into one minifieddist/index.js
file, enabling fast and reliable execution and preventing the need to check in the whole dependency tree innode_modules
.
Here,dist
is intentionallynot committed to Git branches for three reasons:
- Encourage users to reference your action usingsemantically versioned tags like
v1
,v1.1.5
, etc. instead of branches (docs). - Avoid a security vulnerability attack vector by encouraging community contributions to source code only, ignoring proposed compiled release assets.
- Let automation do the hard part 🤖.
A samplePublish workflow is provided which runs on arelease
event to compile and package source code intodist
, and force push major and minor tag versions according to the semantic version of the release. You can kick off this workflow and publish to GitHub Marketplace simply byusing the GitHub UI to create a new semantically versioned release likev1.0.3
.
A healthy open source community starts with communication. Either in this repository or in your organization's.github
repository, we recommend reviewing, editing, and adopting:
CODE_OF_CONDUCT.md
for how to engage in communityCONTRIBUTING.md
for how to contribute to this projectLICENSE.md
for how to legally use and contribute to the projectSECURITY.md
for responsibly disclosing vulnerabilities- Issue and pull request templates
Issues and pull requests from the open source community should be attended to in a prompt, friendly, and proactive manner. Two sample workflows,stale andlabeler are provided to help with two small repetitious tasks.
SeeOpen Source Guides for more guidance on maintaining a strong community.
Pull requests are welcome! SeeCONTRIBUTING.md for more.
About
Create a JavaScript Action with tests, linting, workflow, publishing, and versioning. An opinionated alternative template to actions/javascript-action to bootstrap the creation of a JavaScript action. 🚀
Resources
License
Code of conduct
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.