* Improve documentation issue no #1034 Done with the minor fixes for open issue number #1034 . * Increasing the importance I wanted to delete a branch, but I couldn't in spite of reading this document. The problem was, the branch I wanted to delete was the default branch. Even though it is stated in this document, it was not given enough importance that everyone would see it. * typo A small type in the comments * Update setting-up-your-development-environment-to-create-a-github-app.md Fix two small typos. * properly capitalize "macOS" * Clarify GH password requirements * Change " to ` As done in the description of `master` * " to ` in DE * " to ` in PT * " to ` in RU * Fix typo metadata-syntax-for-github-actions.md Fix typo for metadata-syntax-for-github-actions#outputs-for-composite-run-steps-actions * chore: Remove bolding from headings * Removed deprecated echo set-env instruction * fix typo (#1516) Co-authored-by: hubwriter <hubwriter@github.com> * Remove extraneous grammar period which breaks the compare URL (#1252) * Remove extraneous grammar period which breaks the compare URL * Update data/reusables/repositories/two-dot-diff-comparison-example-urls.md Co-authored-by: Nick Schonning <nschonni@gmail.com> Co-authored-by: Nick Schonning <nschonni@gmail.com> Co-authored-by: hubwriter <hubwriter@github.com> * Revert "" to ` in RU" This reverts commitd484fd6ef5. * Revert "" to ` in PT" This reverts commitfab62f05be. * Revert "" to ` in DE" This reverts commit78abcd6f7a. * Change md This squashes all the translation commits and their deletion. * Update content/github/collaborating-with-issues-and-pull-requests/creating-and-deleting-branches-within-your-repository.md Co-authored-by: Felicity Chapman <felicitymay@github.com> Co-authored-by: Atharva Shirdhankar <72031540+StarTrooper08@users.noreply.github.com> Co-authored-by: Aakarsh B <aakarshbiju@gmail.com> Co-authored-by: Aritra Roy Gosthipaty <aritra.born2fly@gmail.com> Co-authored-by: Guilherme Macedo <guilherme@gmacedo.com> Co-authored-by: Stephen Wade <stephen@stephenwade.me> Co-authored-by: Shao Yang Hong <hongsy2006@gmail.com> Co-authored-by: a2br <62328077+a2br@users.noreply.github.com> Co-authored-by: Cas van Dinter <casvd@hotmail.com> Co-authored-by: Nick Schonning <nschonni@gmail.com> Co-authored-by: Antoine Rondelet <rondelet.antoine@gmail.com> Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com> Co-authored-by: Meg Bird <megbird@github.com> Co-authored-by: ねず <39144575+wonda-tea-coffee@users.noreply.github.com> Co-authored-by: hubwriter <hubwriter@github.com> Co-authored-by: Ilia <ilia@wearebond.com> Co-authored-by: a2br <a2br@users.noreply.github.com> Co-authored-by: Felicity Chapman <felicitymay@github.com> Co-authored-by: Jason Etcovitch <jasonetco@github.com>
144 lines
8.9 KiB
Markdown
144 lines
8.9 KiB
Markdown
---
|
|
title: Quickstart for GitHub Actions
|
|
intro: 'Add a {% data variables.product.prodname_actions %} workflow to an existing repository in 5 minutes or less.'
|
|
allowTitleToDifferFromFilename: true
|
|
redirect_from:
|
|
- /actions/getting-started-with-github-actions/starting-with-preconfigured-workflow-templates
|
|
versions:
|
|
free-pro-team: '*'
|
|
enterprise-server: '>=2.22'
|
|
---
|
|
|
|
{% data reusables.actions.enterprise-beta %}
|
|
{% data reusables.actions.enterprise-github-hosted-runners %}
|
|
|
|
### Introduction
|
|
|
|
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.
|
|
|
|
### Creating your first workflow
|
|
|
|
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)."
|
|
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.
|
|
{% raw %}
|
|
```yaml{:copy}
|
|
name: Super-Linter
|
|
|
|
# Run this workflow every time a new commit pushed to your repository
|
|
on: push
|
|
|
|
jobs:
|
|
# Set the job key. The key is displayed as the job name
|
|
# when a job name is not provided
|
|
super-lint:
|
|
# Name the Job
|
|
name: Lint code base
|
|
# Set the type of machine to run on
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
# Checks out a copy of your repository on the ubuntu-latest machine
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
# Runs the Super-Linter action
|
|
- name: Run Super-Linter
|
|
uses: github/super-linter@v3
|
|
env:
|
|
DEFAULT_BRANCH: main
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
```
|
|
{% endraw %}
|
|
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**.
|
|

|
|
|
|
Committing the workflow file in your repository triggers the `push` event and runs your workflow.
|
|
|
|
### Viewing your workflow results
|
|
|
|
{% data reusables.repositories.navigate-to-repo %}
|
|
{% data reusables.repositories.actions-tab %}
|
|
{% data reusables.repositories.navigate-to-workflow-superlinter %}
|
|
{% data reusables.repositories.view-run-superlinter %}
|
|
1. In the left sidebar, click the **Lint code base** job.
|
|

|
|
{% data reusables.repositories.view-failed-job-results-superlinter %}
|
|
|
|
### More starter workflows
|
|
|
|
{% 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 %}.
|
|
|
|
### Next steps
|
|
|
|
The super-linter workflow you just added runs any 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 %}:
|
|
|
|
- "[Learn {% data variables.product.prodname_actions %}](/actions/learn-github-actions)" for an in-depth tutorial
|
|
- "[Guides](/actions/guides)" for specific uses cases and examples
|
|
- [github/super-linter](https://github.com/github/super-linter) for more details about configuring the Super-Linter action
|
|
|
|
<div id="quickstart-treatment" hidden>
|
|
|
|
### Introduction
|
|
|
|
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.
|
|
|
|
### Creating your first workflow
|
|
|
|
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)."
|
|
2. Copy the following YAML contents into the `hello-world.yml` file.
|
|
{% raw %}
|
|
```yaml{:copy}
|
|
name: Say hello!
|
|
|
|
# GitHub Actions Workflows are automatically triggered by GitHub events
|
|
on:
|
|
# For this workflow, we're using the workflow_dispatch event which is triggered when the user clicks Run workflow in the GitHub Actions UI
|
|
workflow_dispatch:
|
|
# The workflow_dispatch event accepts optional inputs so you can customize the behavior of the workflow
|
|
inputs:
|
|
name:
|
|
description: 'Person to greet'
|
|
required: true
|
|
default: 'World'
|
|
# When the event is triggered, GitHub Actions will run the jobs indicated
|
|
jobs:
|
|
say_hello:
|
|
# Uses a ubuntu-latest runner to complete the requested steps
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- run: |
|
|
echo "Hello ${{ github.event.inputs.name }}!"
|
|
```
|
|
{% endraw %}
|
|
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".
|
|
|
|
### Trigger your workflow
|
|
|
|
{% data reusables.repositories.navigate-to-repo %}
|
|
{% data reusables.repositories.actions-tab %}
|
|
1. In the left sidebar, click the workfow you want to run.
|
|

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

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

|
|
1. In the left sidebar, click the "say_hello" job.
|
|

|
|
1. In the workflow logs, expand the 'Run echo "Hello World!"' section.
|
|

|
|
|
|
### More starter workflows
|
|
|
|
{% 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 %}.
|
|
|
|
### Next steps
|
|
|
|
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 %}:
|
|
|
|
- "[Learn {% data variables.product.prodname_actions %}](/actions/learn-github-actions)" for an in-depth tutorial
|
|
- "[Guides](/actions/guides)" for specific uses cases and examples
|
|
|
|
</div>
|