in Technology by
How YAML syntax is used to create a workflow file GitHub Action?

1 Answer

0 votes
by

this section explains each line of the introduction's example:

Code Explanation
name: learn-github-actions
Optional - The name of the workflow as it will appear in the "Actions" tab of the GitHub repository.
run-name: ${{ github.actor }} is learning GitHub Actions

Optional - The name for workflow runs generated from the workflow, which will appear in the list of workflow runs on your repository's "Actions" tab. This example uses an expression with the github context to display the username of the actor that triggered the workflow run. For more information

on: [push]
Specifies the trigger for this workflow. This example uses the push event, so a workflow run is triggered every time someone pushes a change to the repository or merges a pull request. This is triggered by a push to every branch; for examples of syntax that runs only on pushes to specific branches, paths, or tags
jobs:
Groups together all the jobs that run in the learn-github-actions workflow.
check-bats-version:
Defines a job named check-bats-version. The child keys will define properties of the job.
  runs-on: ubuntu-latest
Configures the job to run on the latest version of an Ubuntu Linux runner. This means that the job will execute on a fresh virtual machine hosted by GitHub. 
  steps:
Groups together all the steps that run in the check-bats-version job. Each item nested under this section is a separate action or shell script.
    - uses: actions/checkout@v3
The uses keyword specifies that this step will run v3 of the actions/checkout action. This is an action that checks out your repository onto the runner, allowing you to run scripts or other actions against your code (such as build and test tools). You should use the checkout action any time your workflow will run against the repository's code.
    - uses: actions/setup-node@v3
      with:
        node-version: '14'
This step uses the actions/setup-node@v3 action to install the specified version of the Node.js (this example uses v14). This puts both the node and npm commands in your PATH.
    - run: npm install -g bats
The run keyword tells the job to execute a command on the runner. In this case, you are using npm to install the bats software testing package.
    - run: bats -v
Finally, you'll run the bats command with a parameter that outputs the software version.
 

Related questions

0 votes
    How to view the activity for a Github action workflow run ?...
asked Jun 17, 2023 in Technology by JackTerrance
0 votes
    map_view plugin is no longer maintained and let users with problems if the min sdk is up to 28, ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 6, 2022 in Education by JackTerrance
0 votes
    For which criteria in workflow “time dependent workflow action” cannot be created?...
asked Nov 11, 2020 in Technology by JackTerrance
0 votes
    Which of the following is a valid YAML syntax? (i)path: F:\test (ii)All the options mentioned (iii)path: F: (iv)path: "F\test"\programs...
asked Jan 25, 2023 in Technology by JackTerrance
0 votes
    What is a YAML file and how do we use it in Ansible?...
asked Jul 28, 2021 in Technology by JackTerrance
0 votes
    Syntax to create a DataFrame based on the content of a JSON file 1. spark.textfile("examples/src/main/resources/data. ... 4. spark.json("examples/src/main/resources/data.json")...
asked Oct 22, 2020 by JackTerrance
0 votes
    I need to use environment variable "PATH" in yaml file which needs to be parsed with a script. ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 10, 2022 in Education by JackTerrance
0 votes
    Can we use JSON instead of YAML while developing docker-compose file in Docker?...
asked Jun 21, 2021 in Technology by JackTerrance
0 votes
    I am reading a yaml file like so in Python3: def get_file(): file_name = "file.yml" properties_stream ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 1, 2022 in Education by JackTerrance
0 votes
    How do you push a file from your local system to the GitHub repository using Git?...
asked Oct 4, 2020 in Technology by Editorial Staff
0 votes
    Which of the following action variable is used to include a file in JSP? (a) jsp:setProperty (b) jsp:getProperty ... JSP & API of Java Select the correct answer from above options...
asked Feb 22, 2022 in Education by JackTerrance
0 votes
    Which of the following action variable is used to include a file in JSP? (a) jsp:setProperty (b) ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Oct 24, 2021 in Education by JackTerrance
0 votes
    Example of an example GitHub action workflow?...
asked Jun 17, 2023 in Technology by JackTerrance
0 votes
    What are GitHub Action workflow templates?...
asked Apr 1, 2023 in Technology by JackTerrance
0 votes
    Update the README.md file in the GitHub Branch starfeature and commit the updates. Which channel would receive ... . Stakeholders C. Starprojectteam D. None of the options...
asked Dec 23, 2022 in Education by JackTerrance
...