-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create my first workflow #2
Conversation
Oh no... I found an error
|
Oh no... I found an error
|
Oh no... I found an error
|
You have triggered a workflow!Great job adding the workflow. Adding that file to this branch is enough for GitHub Actions to begin running on your repository. The time this takes will vary based on the complexity of the workflow. At this point we can ignore the workflow because it doesn't do anything yet, but while this runs I'll briefly explain the components of the workflow you just added. If you want to inspect your running workflow you can do so by heading over to the Actions tab of this repository. |
Anatomy of GitHub ActionsGitHub Actions is a unique world that lives alongside your repository. It is one made up of many moving parts and having a general understanding of these parts will help us understand the behavior we are going to program into our action. From 30,000 feet GitHub Actions is made up of the following components, with each component having its own complexities:
How these pieces fit togetherWhen a repository is configured with a workflow file, like we just created, the following series of events occurs.
|
Go on... Tell me more!I'm glad you asked. Let's take a look at the workflow file that we just committed to this repository. name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Run a one-line script
run: echo Hello, world!
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project. This file is made up of a series of metadata, as well as behaviors that we wish to happen when the workflow is triggered. Let's take a second to talk about each of the pieces that we see here:
📖Take a deeper dive into workflow components |
Digging into a stepAs I mentioned earlier, a step is a task that is either an action or a command. This can be slightly confusing, so I want to take a little time to ensure I explain it to you before moving on. ActionsActions are powerful. They are small programs written in either JavaScript or running inside of Docker containers, that add some functionality to your repository. The things you can do with actions are limited only by your imagination. Want to send a tweet every time you tag a release? What about ordering 🍕just by creating an issue? Let's not forget the more practical usage of actions, testing the source code of a repository or letting your team know that you are out of office 🏝 when they @ mention your name in issues or pull requests. You can define an action's inputs, outputs, and environment variables to create reusable building blocks for your workflow. Actions are portable. You are free to publish your actions to the Actions Marketplace where others can use your creation in their workflows! You can also share actions without publishing them to the marketplace by referencing the repository that contains the actions code! Actions can even run commands 😏 📖Learn more About Actions CommandsCommands are useful in the own respect, but are much more limited than actions. Think about the tasks you might do from the command line of your local machine. Maybe you run You can accomplish the same set of tasks inside of a workflow but using Commands are not easily shareable. There is no central location where you can consume the popular commands used in workflows. You do not have access to fine tuning the inputs, outputs or environment variables. This does not mean commands offer no value in a workflow, but you should use them wisely and if you find yourself reusing the same commands repeatedly, consider turning them into actions. Has Learning Lab stopped responding? Your Actions workflow might be failing. Click here for troubleshooting help.When a GitHub Actions workflow is running, you should see some checks in progress, like the screenshot below. If the checks don't appear or if the checks are stuck in progress, there's a few things you can do to try and trigger them:
|
Edit the current workflowCurrently ⌨️ Activity: Remove boilerplate steps from
|
Finishing the workflow@Cemberk you're doing great so far 😄! You've had to do a lot of workflow set up so we can begin writing custom actions. We have just one more thing to add to our RecapBefore we make our final workflow change let's do a quick recap about what we've done.
If that seems like a lot of things just to get started... well, it is! GitHub Actions is a robust platform designed to automate a wide range of tasks for your repositories. If you'd like to see more examples of workflows and actions then check out these Learning Lab courses all about GitHub Actions:
Add an action reference to the workflow⌨️ Activity: Reference our custom action from
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great Job 👍
Your workflow is now set up to execute two actions when any push
event happens on this repository.
For now, this workflow will fail. It fails because we have not yet created the hello-world
action, so this is expected.
Head over here to get started in creating the hello-world
action!
No description provided.