Skip to content

Commit d2d56ee

Browse files
crichIDrachmariheiskr
authored
Create hello world actions quickstart (#16218)
* create hello world quickstart * Fix image link * Apply suggestions from code review Co-authored-by: Rachael Sewell <[email protected]> * Add step to merge pull request before triggering workflow * Add slash in front of file path * Remove unused reusable * more explaining in hello world quickstart * Add invitation to create new repo * Add experiment code Co-authored-by: Rachael Sewell <[email protected]> Co-authored-by: Kevin Heis <[email protected]>
1 parent 1907a78 commit d2d56ee

File tree

8 files changed

+83
-0
lines changed

8 files changed

+83
-0
lines changed
146 KB
Loading
104 KB
Loading
188 KB
Loading
21 KB
Loading
67.4 KB
Loading
34.3 KB
Loading

content/actions/quickstart.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,69 @@ The super-linter workflow you just added runs any time code is pushed to your re
7575
- "[Learn {% data variables.product.prodname_actions %}](/actions/learn-github-actions)" for an in-depth tutorial
7676
- "[Guides](/actions/guides)" for specific uses cases and examples
7777
- [github/super-linter](https://github.com/github/super-linter) for more details about configuring the Super-Linter action
78+
79+
<div id="quickstart-treatment" hidden>
80+
81+
### Introduction
82+
83+
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, you can use it to test this and future {% data variables.product.prodname_actions %} workflows.
84+
85+
### Creating your first workflow
86+
87+
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)."
88+
2. Copy the following YAML contents into the `hello-world.yml` file.
89+
{% raw %}
90+
```yaml{:copy}
91+
name: Say hello!
92+
93+
# GitHub Actions Workflows are automatically triggered by GitHub events
94+
on:
95+
# For this workflow, we're using the workflow_dispatch event which is triggered when the user clicks Run workflow in the GitHub Actions UI
96+
workflow_dispatch:
97+
# The workflow_dispatch event accepts optional inputs so you can customize the behavior of the workflow
98+
inputs:
99+
name:
100+
description: 'Person to greet'
101+
required: true
102+
default: 'World'
103+
# When the event is triggered, GitHub Actions will run the jobs indicated
104+
jobs:
105+
say_hello:
106+
# Uses a ubuntu-lates runner to complete the requested steps
107+
runs-on: ubuntu-latest
108+
steps:
109+
- run: |
110+
echo "Hello ${{ github.event.inputs.name }}!"
111+
```
112+
{% endraw %}
113+
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**.
114+
![Commit workflow file](/assets/images/help/repository/commit-hello-world-file.png)
115+
4. Once the pull request has been merged, you'll be ready to move on to "Trigger your workflow".
116+
117+
### Trigger your workflow
118+
119+
{% data reusables.repositories.navigate-to-repo %}
120+
{% data reusables.repositories.actions-tab %}
121+
1. In the left sidebar, click the workfow you want to run.
122+
![Select say hello job](/assets/images/help/repository/say-hello-job.png)
123+
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.
124+
![Trigger the manual workflow](/assets/images/help/repository/manual-workflow-trigger.png)
125+
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.
126+
![Workflow run result listing](/assets/images/help/repository/workflow-run-listing.png)
127+
1. In the left sidebar, click the "say_hello" job.
128+
![Workflow job listing](/assets/images/help/repository/workflow-job-listing.png)
129+
1. In the workflow logs, expand the 'Run echo "Hello World!"' section.
130+
![Workflow detail](/assets/images/help/repository/workflow-log-listing.png)
131+
132+
### More starter workflows
133+
134+
{% data variables.product.prodname_dotcom %} provides preconfigured workflow templates that you can start from to automate or create a continuous integration workflows. You can browse the full list of workflow templates in the {% if currentVersion == "free-pro-team@latest" %}[actions/starter-workflows](https://github.com/actions/starter-workflows) repository{% else %} `actions/starter-workflows` repository on {% data variables.product.product_location %}{% endif %}.
135+
136+
### Next steps
137+
138+
The hello-world workflow you just added is a simple 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 %}:
139+
140+
- "[Learn {% data variables.product.prodname_actions %}](/actions/learn-github-actions)" for an in-depth tutorial
141+
- "[Guides](/actions/guides)" for specific uses cases and examples
142+
143+
</div>

javascripts/experiment.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,21 @@ export default function () {
4141
// const xbucket = bucket(testName)
4242
// if (xbucket === TREATMENT) { ... }
4343
// x.addEventListener('click', evt => evt.preventDefault(); await sendSuccess(testName); evt())
44+
45+
const treatment = document.getElementById('quickstart-treatment')
46+
if (!treatment) return
47+
48+
const testName = 'quickstart-hello'
49+
const xbucket = bucket(testName)
50+
51+
if (xbucket === TREATMENT) {
52+
Array.from(
53+
document.querySelectorAll('#article-contents > *')
54+
).forEach(el => { el.hidden = true })
55+
treatment.hidden = false
56+
}
57+
58+
document.documentElement.addEventListener('copy', () => {
59+
sendSuccess(testName)
60+
})
4461
}

0 commit comments

Comments
 (0)