You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You only need an existing {% data variables.product.prodname_dotcom %} repository to create and run a {% data variables.product.prodname_actions %} workflow. In this guide, you'll add a workflow that lints multiple coding languages using the [{% data variables.product.prodname_dotcom %} Super-Linter action](https://github.com/github/super-linter). The workflow uses Super-Linter to validate your source code every time a new commit is pushed to your repository.
22
+
You only need a {% data variables.product.prodname_dotcom %} repository to create and run a {% data variables.product.prodname_actions %} workflow. In this guide, you'll add a workflow that demonstrates some of the essential features of {% data variables.product.prodname_actions %}.
23
+
24
+
The following example shows you how {% data variables.product.prodname_actions %} jobs can be automatically triggered, where they run, and how they can interact with the code in your repository.
23
25
24
26
### Creating your first workflow
25
27
26
-
1. From your repository on {% data variables.product.prodname_dotcom %}, create a new file in the `.github/workflows` directory named `superlinter.yml`. For more information, see "[Creating new files](/github/managing-files-in-a-repository/creating-new-files)."
27
-
2. Copy the following YAML contents into the `superlinter.yml` file. **Note:** If your default branch is not `main`, update the value of `DEFAULT_BRANCH` to match your repository's default branch name.
28
+
1. From your repository on {% data variables.product.prodname_dotcom %}, create a new file in the `.github/workflows` directory named `github-actions-demo.yml`. For more information, see "[Creating new files](/github/managing-files-in-a-repository/creating-new-files)."
29
+
2. Copy the following YAML contents into the `github-actions-demo.yml` file:
28
30
{% raw %}
29
31
```yaml{:copy}
30
-
name: Super-Linter
31
-
32
-
# Run this workflow every time a new commit pushed to your repository
33
-
on: push
34
-
32
+
name: GitHub Actions Demo
33
+
on: [push]
35
34
jobs:
36
-
# Set the job key. The key is displayed as the job name
37
-
# when a job name is not provided
38
-
super-lint:
39
-
# Name the Job
40
-
name: Lint code base
41
-
# Set the type of machine to run on
35
+
Explore-GitHub-Actions:
42
36
runs-on: ubuntu-latest
43
-
44
37
steps:
45
-
# Checks out a copy of your repository on the ubuntu-latest machine
46
-
- name: Checkout code
38
+
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
39
+
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
40
+
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
41
+
- name: Check out repository code
47
42
uses: actions/checkout@v2
43
+
- run: echo "💡 The ${{ github.repository }} repository has been cloned to the runner."
44
+
- run: echo "🖥️ The workflow is now ready to test your code on the runner."
45
+
- name: List files in the repository
46
+
run: |
47
+
ls ${{ github.workspace }}
48
+
- run: echo "🍏 This job's status is ${{ job.status }}."
48
49
49
-
# Runs the Super-Linter action
50
-
- name: Run Super-Linter
51
-
uses: github/super-linter@v3
52
-
env:
53
-
DEFAULT_BRANCH: main
54
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
55
50
```
56
51
{% endraw %}
57
-
3. To run your workflow, scroll to the bottom of the page and select **Create a new branch for this commit and start a pull request**. Then, to create a pull request, click **Propose new file**.
3. Scroll to the bottom of the page and select **Create a new branch for this commit and start a pull request**. Then, to create a pull request, click **Propose new file**.
Committing the workflow file in your repository triggers the `push` event and runs your workflow.
55
+
Committing the workflow file to a branch in your repository triggers the `push` event and runs your workflow.
61
56
62
57
### Viewing your workflow results
63
58
64
59
{% data reusables.repositories.navigate-to-repo %}
65
60
{% data reusables.repositories.actions-tab %}
66
-
{% data reusables.repositories.navigate-to-workflow-superlinter %}
67
-
{% data reusables.repositories.view-run-superlinter %}
68
-
{% if currentVersion == "free-pro-team@latest" or currentVersion ver_gt "enterprise-server@3.0" or currentVersion == "github-ae@latest" %}
69
-
1. Under **Jobs** or in the visualization graph, click the **Lint code base** job.
70
-

71
-
{% else %}
72
-
1. In the left sidebar, click the **Lint code base** job.
73
-

74
-
{% endif %}
75
-
{% data reusables.repositories.view-failed-job-results-superlinter %}
76
-
77
-
### More workflow templates
78
-
79
-
{% data reusables.actions.workflow-template-overview %}
80
-
81
-
### Next steps
82
-
83
-
The super-linter workflow you just added runs each time code is pushed to your repository to help you spot errors and inconsistencies in your code. But this is only the beginning of what you can do with {% data variables.product.prodname_actions %}. Your repository can contain multiple workflows that trigger different jobs based on different events. {% data variables.product.prodname_actions %} can help you automate nearly every aspect of your application development processes. Ready to get started? Here are some helpful resources for taking your next steps with {% data variables.product.prodname_actions %}:
84
-
85
-
- "[Learn {% data variables.product.prodname_actions %}](/actions/learn-github-actions)" for an in-depth tutorial
86
-
- "[Guides](/actions/guides)" for specific uses cases and examples
87
-
- [github/super-linter](https://github.com/github/super-linter) for more details about configuring the Super-Linter action
88
-
89
-
<div id="quickstart-treatment" hidden>
90
-
91
-
### Introduction
61
+
1. In the left sidebar, click the workflow you want to see.
92
62
93
-
Printing "Hello, World!" is a great way to explore the basic set up and syntax of a new programming language. In this guide, you'll use GitHub Actions to print "Hello, World!" within your {% data variables.product.prodname_dotcom %} repository's workflow logs. All you need to get started is a {% data variables.product.prodname_dotcom %} repository where you feel comfortable creating and running a sample {% data variables.product.prodname_actions %} workflow. Feel free to create a new repository for this Quickstart to test this and future {% data variables.product.prodname_actions %} workflows.
63
+

64
+
1. From the list of workflow runs, click the name of the run you want to see.
94
65
95
-
### Creating your first workflow
66
+

67
+
1. Under **Jobs** , click the **Explore-GitHub-Actions** job.
96
68
97
-
1. From your repository on {% data variables.product.prodname_dotcom %}, create a new file in the `.github/workflows` directory named `hello-world.yml`. For more information, see "[Creating new files](/github/managing-files-in-a-repository/creating-new-files)."
98
-
2. Copy the following YAML contents into the `hello-world.yml` file.
99
-
{% raw %}
100
-
```yaml{:copy}
101
-
name: Say hello!
102
-
103
-
# GitHub Actions Workflows are automatically triggered by GitHub events
104
-
on:
105
-
# For this workflow, we're using the workflow_dispatch event which is triggered when the user clicks Run workflow in the GitHub Actions UI
106
-
workflow_dispatch:
107
-
# The workflow_dispatch event accepts optional inputs so you can customize the behavior of the workflow
108
-
inputs:
109
-
name:
110
-
description: 'Person to greet'
111
-
required: true
112
-
default: 'World'
113
-
# When the event is triggered, GitHub Actions will run the jobs indicated
114
-
jobs:
115
-
say_hello:
116
-
# Uses a ubuntu-latest runner to complete the requested steps
117
-
runs-on: ubuntu-latest
118
-
steps:
119
-
- run: |
120
-
echo "Hello ${{ github.event.inputs.name }}!"
121
-
```
122
-
{% endraw %}
123
-
3. Scroll to the bottom of the page and select **Create a new branch for this commit and start a pull request**. Then, to create a pull request, click **Propose new file**.
4. Once the pull request has been merged, you'll be ready to move on to "Trigger your workflow".
126
-
127
-
### Trigger your workflow
128
-
129
-
{% data reusables.repositories.navigate-to-repo %}
130
-
{% data reusables.repositories.actions-tab %}
131
-
1. In the left sidebar, click the workflow you want to run.
132
-

133
-
1. On the right, click the **Run workflow** drop-down and click **Run workflow**. Optionally, you can enter a custom message into the "Person to greet" input before running the workflow.
134
-

135
-
1. The workflow run will appear at the top of the list of "Say hello!" workflow runs. Click "Say hello!" to see the result of the workflow run.
136
-

137
-
1. In the left sidebar, click the "say_hello" job.
{% data reusables.actions.workflow-template-overview %}
145
80
146
81
### Next steps
147
82
148
-
The hello-world workflow you just added is a minimal example of a manually triggered workflow. This is only the beginning of what you can do with {% data variables.product.prodname_actions %}. Your repository can contain multiple workflows that trigger different jobs based on different events. {% data variables.product.prodname_actions %} can help you automate nearly every aspect of your application development processes. Ready to get started? Here are some helpful resources for taking your next steps with {% data variables.product.prodname_actions %}:
83
+
The example workflow you just added runs each time code is pushed to the branch, and shows you how {% data variables.product.prodname_actions %} can work with the contents of your repository. But this is only the beginning of what you can do with {% data variables.product.prodname_actions %}:
84
+
85
+
- Your repository can contain multiple workflows that trigger different jobs based on different events.
86
+
- You can use a workflow to install software testing apps and have them automatically test your code on {% data variables.product.prodname_dotcom %}'s runners.
149
87
150
-
- "[Learn {% data variables.product.prodname_actions %}](/actions/learn-github-actions)" for an in-depth tutorial
151
-
- "[Guides](/actions/guides)" for specific uses cases and examples
88
+
{% data variables.product.prodname_actions %} can help you automate nearly every aspect of your application development processes. Ready to get started? Here are some helpful resources for taking your next steps with {% data variables.product.prodname_actions %}:
152
89
153
-
</div>
90
+
- "[Learn {% data variables.product.prodname_actions %}](/actions/learn-github-actions)" for an in-depth tutorial.
91
+
- "[Guides](/actions/guides)" for specific uses cases and examples.
0 commit comments