Hallo, Entdecker! An dieser Seite wird aktiv gearbeitet, oder sie wird noch übersetzt. Die neuesten und genauesten Informationen findest Du in unserer englischsprachigen Dokumentation.

Quickstart for GitHub Actions

Add a GitHub Actions workflow to an existing repository in 5 minutes or less.

Inhalt dieses Artikels

Einführung

You only need an existing GitHub repository to create and run a GitHub Actions workflow. In this guide, you'll add a workflow that lints multiple coding languages using the GitHub Super-Linter action. 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 GitHub, create a new file in the .github/workflows directory named superlinter.yml. Weitere Informationen finden Sie unter „Neue Dateien erstellen“.

  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.

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

    Commit workflow file

Committing the workflow file in your repository triggers the push event and runs your workflow.

Viewing your workflow results

  1. Navigiere in GitHub zur Hauptseite des Repository.

  2. Klicke unter Deinem Repository-Namen auf Actions (Aktionen).

    Registerkarte „Actions" (Aktionen) auf der Navigationsleiste des Haupt-Repository

  3. Klicke in der linken Seitenleiste auf den Workflow, den Du sehen willst.

    Workflow-Liste in der linken Seitenleiste

  4. From the list of workflow runs, click the name of the run you want to see.

    Name der Workflow-Ausführung

  5. Under Jobs or in the visualization graph, click the Lint code base job.

    Lint code base job

  6. Any failed steps are automatically expanded to display the results.

    Super linter workflow results

More workflow templates

GitHub provides preconfigured workflow templates that you can customize to create your own continuous integration workflow. GitHub analyzes your code and shows you CI templates that might be useful for your repository. Wenn Dein Repository beispielsweise Node.js-Code enthält, werden Vorschläge für Node.js-Projekte angezeigt. Du kannst Workflow-Vorlagen als Ausgangspunkt verwenden, um Deinen benutzerdefinierten Workflow zu erstellen, oder Du kannst sie unverändert zu verwenden.

You can browse the full list of workflow templates in the actions/starter-workflows repository.

Nächste Schritte:

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 GitHub Actions. Your repository can contain multiple workflows that trigger different jobs based on different events. GitHub 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 GitHub Actions:

Did this doc help you?

Privacy policy

Help us make these docs great!

All GitHub docs are open source. See something that's wrong or unclear? Submit a pull request.

Make a contribution

Oder, learn how to contribute.