Create a workflow

  1. From the repository on GitHub, create a new file named GitHub -actions-demo.yml in the.github/workflows directory.

  2. github-actions-demo.yml

name: GitHub Actions Demo
on: [push]
jobs:
  Explore-GitHub-Actions:
    runs-on: ubuntu-latest
    steps:
      - run: echo 🎉 The job was automatically triggered by a ${{ github.event_name }} event."
      - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
      - run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
      - name: Check out repository code
        uses: actions/checkout@v2
      - run: echo The "💡 ${{ github.repository }} repository has been cloned to the runner."
      - run: echo "🖥️ The workflow is now ready to test your code on the runner."
      - name: List files in the repository
        run: | ls ${{ github.workspace }}      - run: echo "🍏 This job's status is ${{ job.status }}."
Copy the code
  1. Scroll to the bottom of the page, then select Create a new branch for this commit and start a pull request. Then, to create a pull request, click Choose New File.

Submitting a workflow file to a branch of the repository triggers a push event and runs the workflow.

View workflow results

  1. On GitHub, navigate to the repository’s main page.

  2. Under the warehouse name, click Actions.

  1. In the left sidebar, click the workflow you want to view.

  1. From the workflow run list, click the name of the run you want to view.

  1. Under Jobs, click the explore-Github -Actions job.

  1. The log shows how each step is handled. Expand any step to see its details.

For example, you can see a list of files in the repository:

The literature

  • GitHub Actions quick start
  • GitHub Actions workflow syntax