AkashNayak6 / writing-javascript-actions

https://lab.github.com/githubtraining/github-actions:-writing-javascript-actions
MIT License
0 stars 0 forks source link

Create a workflow #3

Open AkashNayak6 opened 3 years ago

AkashNayak6 commented 3 years ago

create a workflow

github-learning-lab[bot] commented 3 years ago

Oh no... I found an error ⚠️

Error The title of this pull request isn't what I expected!

Solution Verify the name of your pull request is Create a workflow and keep in mind that this is case-sensitive.

Follow these steps to rename your pull request:

  1. Click on Edit next to the pull request's title.
  2. The title will turn to a text field, Create a workflow in the title field.
  3. Click Save.

I'll respond when I detect this pull request has been renamed.

github-learning-lab[bot] commented 3 years ago

Oh no... I found an error ⚠️

Error The title of this pull request isn't what I expected!

Solution Verify the name of your pull request is Create a workflow and keep in mind that this is case-sensitive.

Follow these steps to rename your pull request:

  1. Click on Edit next to the pull request's title.
  2. The title will turn to a text field, Create a workflow in the title field.
  3. Click Save.

I'll respond when I detect this pull request has been renamed.

github-learning-lab[bot] commented 3 years ago

While we wait!

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. 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.


Actions workflow not running? Click here When a GitHub Actions workflow is running, you should see some checks in progress, like the screenshot below. ![Checks in progress box](https://i.imgur.com/uO6iqYd.png) 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: - Refresh the page, it's possible the workflow ran and the page just hasn't been updated with that change - Try making a commit on this branch. Our workflow is triggered with a `push` event, and committing to this branch will result in a new `push` - Edit the workflow file on GitHub and ensure there are no red lines indicating a syntax problem
github-learning-lab[bot] commented 3 years ago

Anatomy of GitHub Actions

GitHub 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:

Component Description
Action Individual tasks that you combine as steps to create a job. Actions are the smallest portable building block of a workflow. To use an action in a workflow, you must include it as a step.
Artifact Artifacts are the files created when you build and test your code. Artifacts might include binary or package files, test results, screenshots, or log files. Artifacts can be used by the other jobs in the workflow or deployed directly by the workflow.
Event A specific activity that triggers a workflow run.
Job A defined task made up of steps. Each job is run in a fresh instance of the virtual environment. Jobs can run at the same time in parallel or be dependent on the status of a previous job and run sequentially.
Runner Any machine with the GitHub Actions runner application installed. You can use a runner hosted by GitHub or host your own runner. A runner waits for available jobs. Runners run one job at a time reporting the progress, logs, and final result back to GitHub.
Step A step is a set of tasks performed by a job. Steps can run commands or actions.
Virtual Environment The virtual environment of a GitHub-hosted runner includes the virtual machine's hardware configuration, operating system, and installed software.
Workflow A configurable automated process that you can set up in your repository. Workflows are made up of one or more jobs and can be scheduled or activated by an event.

How these pieces fit together

Actions workflow diagram

When a repository is configured with a workflow file, like we just created, the following series of events occurs.

  1. Your GitHub repository listens for an event
  2. That event triggers a workflow run which starts a runner
  3. The runner, regardless of the hosting method, is responsible for carrying out the jobs which are defined
  4. A job is series of steps, which can be actions or commands
  5. When the steps complete a report is generated and can be viewed by anyone with access to the repository
github-learning-lab[bot] commented 3 years ago

Go on... Tell me more!

I'm glad you asked. Let's take a look at a workflow file similar to what 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 📖Read more about configuring workflows

if you don't see a response from me below this, try making a new commit to this branch. Your workflow may have finished before I was ready to listen