GitHub Actions: Build Your First Workflow
Tags: actionshackathon21, github, beginners, opensource
Published: 2021-11-08 22:37:46

## Github Actions: What is it?
GitHub Actions is a tool that conveniently enables you to automate custom workflows inside of your GitHub repository. There is a marketplace filled with already-made actions created by developers around the world that you can use. However, if you’re not able to find an Action for your use-case, you can create your own. And if you want to, feel free to share it on GitHub Marketplace to improve the lives of other developers.

## What is a workflow?
In the above paragraph, I mentioned that GitHub Actions allows you to automate custom workflows, but what is a workflow? A workflow is a configurable, automated process. Each workflow is written in a YAML (Yet Another Markup Language) file using YAML syntax. All workflows can be triggered by events that happen within or to your repository. Examples of events that happen within your repository include: a push or pull request. 

## Actions vs. Workflow: What's the difference?

*The definitions seem pretty similar, so what is the difference?*

The answer is that you can use an action *IN* a workflow!

Actions are standalone commands that are combined into steps to create a job. Actions are the smallest portable building block of a workflow. You can create your own actions, or use actions created by the GitHub community. To use an action in a workflow, you must include it as a step.

## Useful Actions
Developers often find themselves doing tedious tasks that take away from their productivity. Here are some actions I've used in the past that helped me immensely:
-  [Deploying to GitHub Pages](https://github.com/marketplace/actions/deploy-to-github-pages)
-  [Syncing a directory to an AWS S3 bucket](https://github.com/marketplace/actions/s3-sync)
-  [Re-publishing NPM packages on release](https://github.com/marketplace/actions/npm-publish)
- [Checking that a PR meets the basic requirements](https://github.com/mtfoley/pr-compliance-action)

## How do I create my first workflow? 
To write your own workflow for GitHub Actions, create a directory at the root of your project called `.github/workflows/`. Inside the directory is where you will store your workflows. Each workflow file should end with the extension `.yml` indicating that it's written using YAML syntax. 

Follow GitHub's written [tutorial](https://docs.github.com/en/actions/quickstart) to build your very first action in 5 minutes. 

If you want to learn more, you can read about [my personal experience](https://blackgirlbytes.dev/how-to-sync-an-s3-bucket-with-github-actions) setting up a workflow to sync a directory to an AWS S3 bucket.

## Join the GitHub Actions Hackathon
From now until December 8th, GitHub is running a Hackathon. By participating, you have the chance to win gift cards and swag. The challenge is to create and submit a workflow leveraging already [existing actions](https://github.com/marketplace?type=actions). GitHub Marketplace currently has over [10,000 actions](https://github.blog/2021-10-21-github-marketplace-welcomes-its-10000th-action/#:~:text=Celebrating%20the%20power%20of%2010%2C000%20actions&text=Linting%2C%20testing%2C%20and%20validating%20code,Connecting%20to%20third%2Dparty%20services). 

Read [here](https://dev.to/devteam/join-us-for-the-2021-github-actions-hackathon-on-dev-4hn4) to learn more about participating in the hackathon.

And if you need any help regarding actions, I'll be available to answer questions in this [thread](https://dev.to/devteam/github-actions-hackathon-2021-help-thread-1lk0).

*Comment below and tell me some of your favorite actions! I'm curious!*