sittch / writing-javascript-actions Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://lab.github.com/githubtraining/github-actions:-writing-javascript-actions
License: MIT License
Home Page: https://lab.github.com/githubtraining/github-actions:-writing-javascript-actions
License: MIT License
@Sittch our JavaScript actions are going to leverage the GitHub ToolKit for developing GitHub Actions.
This is an external library that we will install using npm
which means that you will need Node.js installed.
I find writing actions to be easier from a local environment vs trying to do everything right here in the repository. Doing these steps locally allows you to use the editor of your choice so that you have all the extensions and snippets you are used to when writing code.
If you do not have a preferred environment then I suggest following along with me exactly as you see on the screen, which means you'll need to install Visual Studio Code.
Most of your work going forward will take place away from your Learning Lab repository, so before continuing with the course ensure you have the following installed on your local machine.
Once you have the necessary tools installed locally, follow these steps to begin creating your first action.
Open the Terminal (Mac and Linux) or Command Prompt (Windows) on your local machine
Clone your Learning Lab repo to your local machine:
git clone https://github.com/Sittch/writing-javascript-actions.git
Navigate to the folder you just cloned:
cd writing-javascript-actions
Create a new branch named hello-world
. This is the branch we will use to write our first action. Please do not capitalize letters unless I do, I run case-sensitive checks to make sure I can help you along the way!
git checkout -b hello-world
Create a new folder for our actions files:
mkdir -p .github/actions/hello-world
Navigate to the hello-world
folder you just created:
cd .github/actions/hello-world
Initialize a new project:
npm init -y
Install the core dependency from the GitHub ToolKit:
npm install --save @actions/core
Commit those newly added files,we will remove the need to upload node_modules in a later step:
git add .
git commit -m 'add project dependencies'
Push your changes to your repository:
git push -u origin hello-world
I will respond once you have finished.
Actions are enabled on your repository by default, but we still have to tell our repository to use them. We do this by creating a workflow file in our repository.
A workflow file can be thought of as the recipe for automating a task. They house the start to finish instructions, in the form of jobs
and steps
, for what should happen based on specific triggers.
Your repository can contain multiple workflow files that carry out a wide variety of tasks. It is important to consider this when deciding on a name for your workflow. The name you choose should reflect the tasks being performed.
In our case, we will use this one workflow file for many things, which leads us to break this convention for teaching purposes.
πRead more about workflows
my-workflow.yml
inside of the folders .github/workflows/
by using the instructions below, or this quicklink.
.github/workflows/my-workflow.yml
.add-initial-workflow
.Create pull request
.It is important to place meaningful content into the body of the pull requests you create throughout this course. This repository will stay with you long after you complete the course. It is advisable that you use the body of the pull requests you create as a way to take long lived notes about thing you want to remember.
Workflow files are the recipe for task automation. This is where actions are placed if I want to use them for a task.
I'll respond in the new pull request when I detect it has been created.
If at any point you're expecting a response and don't see one, refresh the page.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.