Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

NotificationsYou must be signed in to change notification settings

github-developer/javascript-action

Repository files navigation

An opinionated alternative template toactions/javascript-action to bootstrap the creation of a JavaScript action. 🚀

javscript-action statusreleaseContributor Covenant

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.

Usage

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! 🚀

Development

1. Update your action metadata inaction.yml

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.

2. Write your action code inlib

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.

3. Test your action intests

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.

4. Automate releases with GitHub Actions

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:

  1. Encourage users to reference your action usingsemantically versioned tags likev1,v1.1.5, etc. instead of branches (docs).
  2. Avoid a security vulnerability attack vector by encouraging community contributions to source code only, ignoring proposed compiled release assets.
  3. 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.

🔁 Commit to open source maintainership

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 community
  • CONTRIBUTING.md for how to contribute to this project
  • LICENSE.md for how to legally use and contribute to the project
  • SECURITY.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.

License

MIT

Contributing

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

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp