Note: GitHub Actions support on GitHub Enterprise Server 2.22 is a limited public beta. To review the external storage requirements and request access to the beta, see "Getting started with GitHub Actions for GitHub Enterprise Server."
Note: GitHub-hosted runners are not currently supported on GitHub Enterprise Server. You can see more information about planned future support on the GitHub public roadmap.
Introduction
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
-
From your repository on GitHub, create a new file in the
.github/workflows
directory namedsuperlinter.yml
. For more information, see "Creating new files." -
Copy the following YAML contents into the
superlinter.yml
file. Note: If your default branch is notmain
, update the value ofDEFAULT_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 }}
-
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
-
On GitHub Enterprise Server, navigate to the main page of the repository.
-
Under your repository name, click Actions.
-
In the left sidebar, click the workflow you want to see.
-
From the list of workflow runs, click the name of the run you want to see.
-
In the left sidebar, click the Lint code base job.
-
Expand the Run Super-Linter step to view the results.
More workflow templates
GitHub provides preconfigured workflow templates that you can customize to create your own continuous integration workflow. GitHub Enterprise Server analyzes your code and shows you CI templates that might be useful for your repository. For example, if your repository contains Node.js code, you'll see suggestions for Node.js projects. You can use workflow templates as a starting place to build your custom workflow or use them as-is.
You can browse the full list of workflow templates in the actions/starter-workflows
repository on your GitHub Enterprise Server instance.
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 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:
- "Learn GitHub Actions" for an in-depth tutorial
- "Guides" for specific uses cases and examples
- github/super-linter for more details about configuring the Super-Linter action
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 GitHub repository's workflow logs. All you need to get started is a GitHub repository where you feel comfortable creating and running a sample GitHub Actions workflow. Feel free to create a new repository for this Quickstart, you can use it to test this and future GitHub Actions workflows.
Creating your first workflow
-
From your repository on GitHub, create a new file in the
.github/workflows
directory namedhello-world.yml
. For more information, see "Creating new files." -
Copy the following YAML contents into the
hello-world.yml
file.YAML 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 }}!"
-
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.
-
Once the pull request has been merged, you'll be ready to move on to "Trigger your workflow".
Trigger your workflow
- On GitHub Enterprise Server, navigate to the main page of the repository.
- Under your repository name, click Actions.
- In the left sidebar, click the workflow you want to run.
- 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.
- 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.
- In the left sidebar, click the "say_hello" job.
- In the workflow logs, expand the 'Run echo "Hello World!"' section.
More workflow templates
GitHub provides preconfigured workflow templates that you can customize to create your own continuous integration workflow. GitHub Enterprise Server analyzes your code and shows you CI templates that might be useful for your repository. For example, if your repository contains Node.js code, you'll see suggestions for Node.js projects. You can use workflow templates as a starting place to build your custom workflow or use them as-is.
You can browse the full list of workflow templates in the actions/starter-workflows
repository on your GitHub Enterprise Server instance.
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 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:
- "Learn GitHub Actions" for an in-depth tutorial
- "Guides" for specific uses cases and examples