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
Copy file name to clipboardExpand all lines: learn-pr/github/github-actions-automate-tasks/includes/2-github-actions-automate-development-tasks.md
+42Lines changed: 42 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -156,6 +156,48 @@ The last part of this workflow file sets the `MY_NAME` variable value for this w
156
156
157
157
For more information on workflow syntax, see [Workflow syntax for GitHub Actions](https://docs.github.com/actions/using-workflows/workflow-syntax-for-github-actions?azure-portal=true)
158
158
159
+
## Referencing Actions in Workflows
160
+
161
+
When creating workflows in GitHub Actions, you can reference actions from various sources. These actions can be used to automate tasks in your workflows. Below are the primary sources where workflows can reference actions:
162
+
163
+
1. **A published Docker container image on Docker Hub**
164
+
Workflows can reference actions that are published as Docker container images on Docker Hub. These actions are containerized and include all dependencies required to execute the action. To use such an action, you specify the Docker image in the `uses` attribute of your workflow step. For example:
165
+
```yml
166
+
steps:
167
+
- name: Run a Docker action
168
+
uses: docker://<docker-image-name>:<tag>
169
+
```
170
+
171
+
2. **Any public repository**
172
+
Actions hosted in public repositories can be directly referenced in your workflows. These actions are accessible to anyone and can be used by specifying the repository name and version (Git ref, SHA, or tag) in the `uses` attribute. For example:
173
+
```yml
174
+
steps:
175
+
- name: Use a public action
176
+
uses: actions/checkout@v3
177
+
```
178
+
179
+
3. **The same repository as your workflow file**
180
+
You can reference actions stored in the same repository as your workflow file. This is useful for custom actions that are specific to your project. To reference such actions, use a relative path to the action's directory. For example:
181
+
```yml
182
+
steps:
183
+
- name: Use a local action
184
+
uses: ./path-to-action
185
+
```
186
+
187
+
4. **An enterprise marketplace**
188
+
If your organization uses GitHub Enterprise, you can reference actions from your enterprise's private marketplace. These actions are curated and managed by your organization, ensuring compliance with internal standards. For example:
189
+
```yml
190
+
steps:
191
+
- name: Use an enterprise marketplace action
192
+
uses: enterprise-org/action-name@v1
193
+
```
194
+
195
+
### Additional Notes
196
+
- Actions in private repositories can also be referenced, but they require proper authentication and permissions.
197
+
- When referencing actions, always specify a version (Git ref, SHA, or tag) to ensure consistency and avoid unexpected changes.
198
+
199
+
For more information, see [Referencing actions in workflows](https://docs.github.com/actions/using-workflows/referencing-actions-in-workflows?azure-portal=true).
200
+
159
201
## GitHub-hosted versus self-hosted runners
160
202
161
203
We briefly mentioned runners as being associated with a job. A runner is simply a server that has the GitHub Actions runner application installed. In the previous workflow example, there was a `runs-on: ubuntu-latest` attribute within the jobs block, which told the workflow that the job will run using the GitHub-hosted runner that's running in the `ubuntu-latest` environment.
0 commit comments