Github Actions is a powerful tool for automating your software workflows directly within your GitHub repository. If you're new to GitHub Actions, this quick tutorial will guide you through creating, triggering, and monitoring your first automated workflow in no time.

Before we delve into the meat of the tutorial, ensure you have the following prerequisites: a GitHub account, a repository, and basic familiarity with Git and GitHub. Let's dive right in!

Creating Your First Workflow File
A workflow file is a YAML file in your repository that defines the jobs and their steps. It resides in the .github/workflows directory. Let's create your first workflow file.

1. In your repository, create a new directory named '.github/workflows'. If the '.github' directory doesn't exist, create that first.
Project Setup

First, let's create a simple project to demonstrate GitHub Actions. In your repository, create an empty file named 'hello-world.js'.
2. Add the following line to 'hello-world.js' and push it to your repository:
```javascript console.log("Hello, world!"); ```
Creating the Workflow File

3. Now, create a new file in the '.github/workflows' directory, naming it 'hello-world.yml'.
4. Add the following content to 'hello-world.yml' and push it to your repository:
```yaml name: Hello, World! on: push: branches: [ main ] jobs: say-hello: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Say hello run: node hello-world.js ```
The 'say-hello' job will run on any push to the 'main' branch. It will checkout your code, and then run the 'node hello-world.js' command, which will print "Hello, world!"

Triggering Your First Workflow
Now that you've created your first workflow, let's trigger it!




















Making a Git Commit
1. Make a new commit in your local repository to trigger the GitHub Actions workflow.
2. Push your commit to the 'main' branch of your repository.
Monitoring the Workflow Run
Next, let's see how the workflow run progresses in real-time.
3. In your repository, click on the "Actions" tab. You'll see a list of your workflows. Find the "Hello, World!" one and click on it.
4. Click on the latest workflow run. You'll see the progress of each job step in real-time. Once completed, you'll see the output from 'node hello-world.js': "Hello, world!"
Modifying and Running Workflows
Let's make our workflow a bit more dynamic. We'll introduce environment variables and a loop.
Environment Variables
1. Add the following lines to your 'hello-world.yml' workflow file:
```yaml env: MESSAGE: "Goodbye, world!" ... steps: - uses: actions/checkout@v2 - name: Say hello run: echo "$MESSAGE" ```
Now, modify your 'hello-world.js' file to use this variable:
```javascript const message = process.env.MESSAGE || "Hello, world!"; console.log(message); ```
Running a For Loop
2. Let's run the 'echo' command in a loop five times, each time with a different message:
```yaml name: Hello, World! on: push: branches: [ main ] env: MESSAGES: "Hello, world!\nHow are you?\nWhat's up?\nNot much.\nHow about you?" COUNT: 5 jobs: say-hello: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Say hello run: | for i in `seq 1 $COUNT` do echo "${!MESSAGES$i}" done ```
Now, push these changes to the 'main' branch and watch your workflow run. You'll see five outputs, one for each iteration of the loop.
And there you have it! You've created, triggered, and modified your first GitHub Actions workflow. Happy automating!