content large_stringlengths 3 20.5k | url large_stringlengths 54 193 | branch large_stringclasses 4 values | source large_stringclasses 42 values | embeddings listlengths 384 384 | score float64 -0.21 0.65 |
|---|---|---|---|---|---|
{% data reusables.actions.custom-deployment-protection-rules-beta-note %} ## About custom deployment protection rules Custom deployment protection rules are powered by {% data variables.product.prodname\_github\_apps %}. Once a deployment protection rule is configured and installed in a repository, it can be enabled for any environments in the repository. After you enable a custom deployment protection rule on an environment, every time a workflow step targets that environment, the deployment protection rule will run automatically. For more information about targeting an environment for deployments, see [AUTOTITLE](/actions/deployment/targeting-different-environments/managing-environments-for-deployment). When a custom deployment protection rule is triggered it will wait for up to 30 days for a webhook event response before it times out and the workflow job fails. For more information about creating your own custom deployment protection rules, see [AUTOTITLE](/actions/deployment/protecting-deployments/creating-custom-deployment-protection-rules). {% data reusables.actions.custom-deployment-protection-rules-limits %} ## Using existing custom deployment protection rules You can choose to create your own custom deployment protection rules or you may use any existing custom deployment protection rules. The following is a list of official partner implementations for deployment protection rules. \* Datadog: you can enforce protection rules on your {% data variables.product.prodname\_actions %} deployment workflows using Datadog monitors. For more information, see [Gating your {% data variables.product.prodname\_actions %} Deployments with Datadog Monitors](https://docs.datadoghq.com/continuous\_integration/guides/github\_gating/) in the Datadog documentation. \* Honeycomb: you can define thresholds to reject or approve deployments based on data you are sending to Honeycomb. For more information, see [the Honeycomb app](https://github.com/apps/honeycomb-io) in the {% data variables.product.prodname\_marketplace %}. \* New Relic: for more information, see [the New Relic app](https://github.com/apps/new-relic-gate) in the {% data variables.product.prodname\_marketplace %}. \* NCM NodeSource: for more information, see [the NCM NodeSource app](https://github.com/apps/ncm-nodesource) in the {% data variables.product.prodname\_marketplace %}. \* Sentry: for more information, see [the Sentry Deployment Gate app](https://github.com/apps/sentry-deployment-gate) in the {% data variables.product.prodname\_marketplace %}. \* ServiceNow: for more information, see [GitHub integration with DevOps Change Velocity](https://www.servicenow.com/docs/bundle/utah-devops/page/product/enterprise-dev-ops/concept/github-integration-dev-ops.html) in the ServiceNow documentation. ## Prerequisites In order for a custom deployment protection rule to be available to all environments in a repository, you must first install the custom deployment protection rule on the repository. For more information, see [AUTOTITLE](/apps/maintaining-github-apps/installing-github-apps). After a custom deployment protection rule has been installed in a repository, it must be enabled for each environment where you want the rule to apply. ## Enabling custom deployment protection rules for the environment {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.actions.sidebar-environment %} 1. Select the environment you want to configure. 1. Under "Deployment protection rules," check the box next to each custom deployment protection rule you want to enable for the environment. 1. Click \*\*Save protection rules\*\*. Once a custom deployment protection rule has been enabled for an environment, it will automatically run whenever a workflow reaches a job that references the environment. You can see the results of an approval or rejection for your deployment by reviewing the details of the deployment. For more information, see [AUTOTITLE](/actions/managing-workflow-runs/reviewing-deployments). | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/configure-and-manage-deployments/configure-custom-protection-rules.md | main | github-actions | [
-0.056147266179323196,
0.020823050290346146,
-0.008224701508879662,
-0.013379096984863281,
0.0551304966211319,
-0.055558640509843826,
0.00005210475865169428,
-0.03624889999628067,
-0.0016660786932334304,
0.025227829813957214,
0.04852423444390297,
-0.02776220627129078,
0.05190075933933258,
... | 0.105127 |
## Viewing your repository's deployment history On the deployments page of your repository, you can view the following aspects of your deployments. \* Currently active deployments across various environments \* Deployments filtered by environment \* Your repository's full deployment history \* Associated commits that triggered the deployment \* Connected {% data variables.product.prodname\_actions %} workflow logs \* The deployment URL (if one exists) \* The source pull request and branch related to each deployment \* Deployment statuses. For more information about deployment statuses, see [AUTOTITLE](/rest/deployments/deployments#about-deployments). By default, the deployments page shows currently active deployments from select environments and a timeline of the latest deployments for all environments. 1. In the right-hand sidebar of the home page of your repository, click \*\*Deployments\*\*. 1. Once you are on the "Deployments" page, you can view the following information about your deployment history. \* \*\*To view recent deployments for a specific environment\*\*, in the "Environments" section of the left sidebar, click an environment. \* \*\*To pin an environment to the top of the deployment history list\*\*, repository administrators can click {% octicon "pin" aria-label="Pin environment" %} to the right of the environment. You can pin up to ten environments. \* \*\*To view the commit that triggered a deployment\*\*, in the deployment history list, click the commit message for the deployment you want to view. >[!NOTE]Deployments from commits that originate from a fork outside of the repository will not show links to the source pull request and branch related to each deployment. For more information about forks, see [AUTOTITLE](/pull-requests/collaborating-with-pull-requests/working-with-forks/about-forks). \* \*\*To view the URL for a deployment\*\*, to the right of the commit message in the deployment history list, click {% octicon "link-external" aria-label="Navigate to deployment URL" %}. \* \*\*To navigate to the workflow run logs associated with a deployment\*\*, to the right of the commit message in the deployment history list, click {% octicon "kebab-horizontal" aria-label="View logs" %}, then click \*\*View logs\*\*. 1. Optionally, to filter the deployment history list, create a filter. 1. Click on the \*\*{% octicon "filter" aria-hidden="true" aria-label="filter" %} Filter\*\* button. 1. Click \*\*{% octicon "plus" aria-hidden="true" aria-label="plus" %} Add a filter\*\*. 1. Choose a qualifier you would like to filter the deployment history by. 1. Depending on the qualifier you chose, fill out information in the "Operator" and "Value" columns. 1. Optionally, click \*\*{% octicon "plus" aria-hidden="true" aria-label="plus" %} Add a filter\*\* to add another filter. 1. Click \*\*Apply\*\*. | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/configure-and-manage-deployments/view-deployment-history.md | main | github-actions | [
0.04405108839273453,
-0.0764739140868187,
-0.022835180163383484,
-0.019551413133740425,
0.05411849170923233,
0.015242706052958965,
0.02203615941107273,
-0.03919186070561409,
0.045789822936058044,
0.03717196360230446,
0.004845295567065477,
0.010255458764731884,
-0.0025008919183164835,
-0.03... | 0.073765 |
## Approving or rejecting a job 1. Navigate to the workflow run that requires review. For more information about navigating to a workflow run, see [AUTOTITLE](/actions/monitoring-and-troubleshooting-workflows/viewing-workflow-run-history). 1. If the run requires review, you will see a notification for the review request. On the notification, click \*\*Review deployments\*\*. 1. Select the job environment(s) to approve or reject. Optionally, leave a comment. 1. Approve or reject: \* To approve the job, click \*\*Approve and deploy\*\*. Once a job is approved (and any other deployment protection rules have passed), the job will proceed. At this point, the job can access any secrets stored in the environment. \* To reject the job, click \*\*Reject\*\*. If a job is rejected, the workflow will fail. > [!NOTE] > If the targeted environment is configured to prevent self-approvals for deployments, you will not be able to approve a deployment from a workflow run you initiated. For more information, see [AUTOTITLE](/actions/deployment/targeting-different-environments/managing-environments-for-deployment#required-reviewers). ## Bypassing deployment protection rules If you have configured deployment protection rules that control whether software can be deployed to an environment, you can bypass these rules and force all pending jobs referencing the environment to proceed. > [!NOTE] > \* You cannot bypass deployment protection rules if the environment has been configured to prevent admins from bypassing configured protection rules. For more information, see [AUTOTITLE](/actions/deployment/targeting-different-environments/managing-environments-for-deployment#creating-an-environment). > \* You can only bypass deployment protection rules during workflow execution when a job referencing the environment is in a "Pending" state. 1. Navigate to the workflow run. For more information about navigating to a workflow run, see [AUTOTITLE](/actions/monitoring-and-troubleshooting-workflows/viewing-workflow-run-history). 1. To the right of \*\*Deployment protection rules\*\*, click \*\*Start all waiting jobs\*\*.  1. In the pop-up window, select the environments for which you want to bypass deployment protection rules. 1. Under \*\*Leave a comment\*\*, enter a description for bypassing the deployment protection rules. 1. Click \*\*I understand the consequences, start deploying\*\*. | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/configure-and-manage-deployments/review-deployments.md | main | github-actions | [
-0.029227370396256447,
0.013400943018496037,
0.006053438410162926,
-0.0026515203062444925,
0.07453230768442154,
-0.07374441623687744,
-0.006784498225897551,
-0.12512439489364624,
0.0011830356670543551,
0.022999513894319534,
-0.015717890113592148,
-0.06833318620920181,
0.05633484944701195,
... | 0.032807 |
## Prerequisites {% ifversion fpt %} > [!NOTE] > Users with {% data variables.product.prodname\_free\_user %} plans can only configure environments for public repositories. If you convert a repository from public to private, any configured protection rules or environment secrets will be ignored, and you will not be able to configure any environments. If you convert your repository back to public, you will have access to any previously configured protection rules and environment secrets. > > Organizations with {% data variables.product.prodname\_team %} and users with {% data variables.product.prodname\_pro %} can configure environments for private repositories. For more information, see [AUTOTITLE](/get-started/learning-about-github/githubs-plans). {% endif %} \* For general information about environments, see [AUTOTITLE](/actions/concepts/use-cases/deploying-with-github-actions#using-environments). \* For information about available rules, see [AUTOTITLE](/actions/reference/deployments-and-environments). ## Creating an environment {% data reusables.actions.permissions-statement-environment %} {% ifversion fpt %} > [!NOTE] > \* Creation of an environment in a private repository is available to organizations with {% data variables.product.prodname\_team %} and users with {% data variables.product.prodname\_pro %}. > \* Some features for environments have no or limited availability for private repositories. If you are unable to access a feature described in the instructions below, please see the documentation linked in the related step for availability information. {% endif %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.actions.sidebar-environment %} {% data reusables.actions.new-environment %} {% data reusables.actions.name-environment %} 1. Optionally, specify people or teams that must approve workflow jobs that use this environment. For more information, see [AUTOTITLE](/actions/reference/deployments-and-environments#required-reviewers). 1. Select \*\*Required reviewers\*\*. 1. Enter up to 6 people or teams. Only one of the required reviewers needs to approve the job for it to proceed. 1. Optionally, to prevent users from approving workflows runs that they triggered, select \*\*Prevent self-review\*\*. 1. Click \*\*Save protection rules\*\*. 1. Optionally, specify the amount of time to wait before allowing workflow jobs that use this environment to proceed. For more information, see [AUTOTITLE](/actions/reference/deployments-and-environments#wait-timer). 1. Select \*\*Wait timer\*\*. 1. Enter the number of minutes to wait. 1. Click \*\*Save protection rules\*\*. 1. Optionally, disallow bypassing configured protection rules. For more information, see [AUTOTITLE](/actions/reference/deployments-and-environments#allow-administrators-to-bypass-configured-protection-rules). 1. Deselect \*\*Allow administrators to bypass configured protection rules\*\*. 1. Click \*\*Save protection rules\*\*. 1. Optionally, enable any custom deployment protection rules that have been created with {% data variables.product.prodname\_github\_apps %}. For more information, see [AUTOTITLE](/actions/reference/deployments-and-environments#custom-deployment-protection-rules). 1. Select the custom protection rule you want to enable. 1. Click \*\*Save protection rules\*\*. 1. Optionally, specify what branches and tags can deploy to this environment. For more information, see [AUTOTITLE](/actions/reference/deployments-and-environments#deployment-branches-and-tags). 1. Select the desired option in the \*\*Deployment branches\*\* dropdown. 1. If you chose \*\*Selected branches and tags\*\*, to add a new rule, click \*\*Add deployment branch or tag rule\*\* 1. In the "Ref type" dropdown menu, depending on what rule you want to apply, click \*\*{% octicon "git-branch" aria-hidden="true" aria-label="git-branch" %} Branch\*\* or \*\*{% octicon "tag" aria-hidden="true" aria-label="tag" %} Tag\*\*. 1. Enter the name pattern for the branch or tag that you want to allow. {% data reusables.actions.branch-and-tag-deployment-rules-configuration %} 1. Click \*\*Add rule\*\*. 1. Optionally, add environment secrets. These secrets are only available to workflow jobs that use the environment. Additionally, workflow jobs that use this environment can only access these secrets after any configured rules (for example, required reviewers) pass. For more information, see [AUTOTITLE](/actions/reference/deployments-and-environments#environment-secrets). 1. Under \*\*Environment secrets\*\*, click \*\*Add Secret\*\*. 1. Enter the secret name. 1. Enter the secret value. 1. Click \*\*Add secret\*\*. 1. Optionally, add environment variables. These variables are only available to workflow jobs that use the environment, and are only accessible using the [`vars`](/actions/learn-github-actions/contexts#vars-context) context. For more information, see [AUTOTITLE](/actions/reference/deployments-and-environments#environment-variables). 1. Under \*\*Environment variables\*\*, click \*\*Add Variable\*\*. 1. Enter the variable name. 1. Enter | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/configure-and-manage-deployments/manage-environments.md | main | github-actions | [
0.040798693895339966,
-0.007016792893409729,
-0.07995877414941788,
-0.034732066094875336,
0.08171886205673218,
0.005558110773563385,
-0.006475010421127081,
0.04552054777741432,
-0.11176417768001556,
0.043392155319452286,
0.06342218071222305,
-0.02329651638865471,
0.026203013956546783,
0.00... | 0.024108 |
secret value. 1. Click \*\*Add secret\*\*. 1. Optionally, add environment variables. These variables are only available to workflow jobs that use the environment, and are only accessible using the [`vars`](/actions/learn-github-actions/contexts#vars-context) context. For more information, see [AUTOTITLE](/actions/reference/deployments-and-environments#environment-variables). 1. Under \*\*Environment variables\*\*, click \*\*Add Variable\*\*. 1. Enter the variable name. 1. Enter the variable value. 1. Click \*\*Add variable\*\*. You can also create and configure environments through the REST API. For more information, see [AUTOTITLE](/rest/deployments/environments), [AUTOTITLE](/rest/actions/secrets), [AUTOTITLE](/rest/actions/variables), and [AUTOTITLE](/rest/deployments/branch-policies). Running a workflow that references an environment that does not exist will create an environment with the referenced name. If the environment is created from running implicit page builds (for example, from a branch or folder source), the source branch will be added as a protection rule to the environment. Otherwise, the newly created environment will not have any protection rules or secrets configured. Anyone that can edit workflows in the repository can create environments via a workflow file, but only repository admins can configure the environment. ## Deleting an environment {% data reusables.actions.permissions-statement-environment %} Deleting an environment will delete all secrets and protection rules associated with the environment. Any jobs currently waiting because of protection rules from the deleted environment will automatically fail. {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.actions.sidebar-environment %} 1. Next to the environment that you want to delete, click {% octicon "trash" aria-label="Delete environment" %}. 1. Click \*\*I understand, delete this environment\*\*. You can also delete environments through the REST API. For more information, see [AUTOTITLE](/rest/repos#environments). ## How environments relate to deployments {% data reusables.actions.environment-deployment-event %} You can access these objects through the REST API or GraphQL API. You can also subscribe to these webhook events. For more information, see [AUTOTITLE](/rest/repos#deployments), [AUTOTITLE](/graphql/reference/objects#deployment) (GraphQL API), or [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads#deployment). ## Next steps {% data variables.product.prodname\_actions %} provides several features for managing your deployments. For more information, see [AUTOTITLE](/actions/deployment/about-deployments/deploying-with-github-actions). | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/configure-and-manage-deployments/manage-environments.md | main | github-actions | [
-0.005451829172670841,
-0.030807316303253174,
-0.0740155354142189,
0.015243932604789734,
0.02293807454407215,
-0.021454835310578346,
-0.0012838358525186777,
-0.023478003218770027,
0.05137304961681366,
-0.018360499292612076,
-0.029665526002645493,
-0.11073390394449234,
0.08999325335025787,
... | 0.04114 |
## Prerequisites Before creating your {% data variables.product.prodname\_actions %} workflow, you will first need to complete the following setup steps: {% data reusables.actions.create-azure-app-plan %} 1. Create a web app. For example, you can use the Azure CLI to create an Azure App Service web app: ```shell copy az webapp create \ --name MY\_WEBAPP\_NAME \ --plan MY\_APP\_SERVICE\_PLAN \ --resource-group MY\_RESOURCE\_GROUP \ --deployment-container-image-name nginx:latest ``` In the command above, replace the parameters with your own values, where `MY\_WEBAPP\_NAME` is a new name for the web app. {% data reusables.actions.create-azure-publish-profile %} 1. Set registry credentials for your web app. Create a {% data variables.product.pat\_v1 %} with the `repo` and `read:packages` scopes. For more information, see [AUTOTITLE](/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token). Set `DOCKER\_REGISTRY\_SERVER\_URL` to `https://ghcr.io`, `DOCKER\_REGISTRY\_SERVER\_USERNAME` to the GitHub username or organization that owns the repository, and `DOCKER\_REGISTRY\_SERVER\_PASSWORD` to your {% data variables.product.pat\_generic %} from above. This will give your web app credentials so it can pull the container image after your workflow pushes a newly built image to the registry. You can do this with the following Azure CLI command: ```shell az webapp config appsettings set \ --name MY\_WEBAPP\_NAME \ --resource-group MY\_RESOURCE\_GROUP \ --settings DOCKER\_REGISTRY\_SERVER\_URL=https://ghcr.io DOCKER\_REGISTRY\_SERVER\_USERNAME=MY\_REPOSITORY\_OWNER DOCKER\_REGISTRY\_SERVER\_PASSWORD=MY\_PERSONAL\_ACCESS\_TOKEN ``` 1. Optionally, configure a deployment environment. {% data reusables.actions.about-environments %} ## Creating the workflow Once you've completed the prerequisites, you can proceed with creating the workflow. The following example workflow demonstrates how to build and deploy a Docker container to Azure App Service when there is a push to the `main` branch. Ensure that you set `AZURE\_WEBAPP\_NAME` in the workflow `env` key to the name of the web app you created. {% data reusables.actions.delete-env-key %} ```yaml copy {% data reusables.actions.actions-not-certified-by-github-comment %} {% data reusables.actions.actions-use-sha-pinning-comment %} name: Build and deploy a container to an Azure Web App env: AZURE\_WEBAPP\_NAME: MY\_WEBAPP\_NAME # set this to your application's name on: push: branches: - main permissions: contents: 'read' packages: 'write' jobs: build: runs-on: ubuntu-latest steps: - uses: {% data reusables.actions.action-checkout %} - name: Set up Docker Buildx uses: docker/setup-buildx-action@7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b - name: Log in to GitHub container registry uses: docker/login-action@8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d with: registry: ghcr.io username: {% raw %}${{ github.actor }}{% endraw %} password: {% raw %}${{ secrets.GITHUB\_TOKEN }}{% endraw %} - name: Lowercase the repo name run: echo "REPO=${GITHUB\_REPOSITORY,,}" >>${GITHUB\_ENV} - name: Build and push container image to registry uses: docker/build-push-action@9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f with: push: true tags: ghcr.io/{% raw %}${{ env.REPO }}{% endraw %}:{% raw %}${{ github.sha }}{% endraw %} file: ./Dockerfile deploy: runs-on: ubuntu-latest needs: build environment: name: 'production' url: {% raw %}${{ steps.deploy-to-webapp.outputs.webapp-url }}{% endraw %} steps: - name: Lowercase the repo name run: echo "REPO=${GITHUB\_REPOSITORY,,}" >>${GITHUB\_ENV} - name: Deploy to Azure Web App id: deploy-to-webapp uses: azure/webapps-deploy@85270a1854658d167ab239bce43949edb336fa7c with: app-name: {% raw %}${{ env.AZURE\_WEBAPP\_NAME }}{% endraw %} publish-profile: {% raw %}${{ secrets.AZURE\_WEBAPP\_PUBLISH\_PROFILE }}{% endraw %} images: 'ghcr.io/{% raw %}${{ env.REPO }}{% endraw %}:{% raw %}${{ github.sha }}{% endraw %}' ``` ## Further reading \* For the original workflow template, see [`azure-container-webapp.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-container-webapp.yml) in the {% data variables.product.prodname\_actions %} `starter-workflows` repository. \* The action used to deploy the web app is the official Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) action. \* For more examples of GitHub Action workflows that deploy to Azure, see the [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) repository. | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/deploy-to-third-party-platforms/docker-to-azure-app-service.md | main | github-actions | [
-0.026188932359218597,
-0.006329388823360205,
-0.06579434871673584,
-0.009918990544974804,
-0.04652803763747215,
0.05179209262132645,
0.07682066410779953,
0.03914728760719299,
-0.04065922647714615,
0.10312091559171677,
0.006016574800014496,
-0.043656107038259506,
0.04596281424164772,
0.062... | -0.009582 |
## Prerequisites Before creating your {% data variables.product.prodname\_actions %} workflow, you will first need to complete the following setup steps: {% data reusables.actions.create-azure-app-plan %} 1. Create a web app. For example, you can use the Azure CLI to create an Azure App Service web app with a Java runtime: ```bash copy az webapp create \ --name MY\_WEBAPP\_NAME \ --plan MY\_APP\_SERVICE\_PLAN \ --resource-group MY\_RESOURCE\_GROUP \ --runtime "JAVA|11-java11" ``` In the command above, replace the parameters with your own values, where `MY\_WEBAPP\_NAME` is a new name for the web app. {% data reusables.actions.create-azure-publish-profile %} 1. Optionally, configure a deployment environment. {% data reusables.actions.about-environments %} ## Creating the workflow Once you've completed the prerequisites, you can proceed with creating the workflow. The following example workflow demonstrates how to build and deploy a Java project to Azure App Service when there is a push to the `main` branch. Ensure that you set `AZURE\_WEBAPP\_NAME` in the workflow `env` key to the name of the web app you created. If you want to use a Java version other than `11`, change `JAVA\_VERSION`. {% data reusables.actions.delete-env-key %} ```yaml copy {% data reusables.actions.actions-not-certified-by-github-comment %} {% data reusables.actions.actions-use-sha-pinning-comment %} name: Build and deploy JAR app to Azure Web App env: AZURE\_WEBAPP\_NAME: MY\_WEBAPP\_NAME # set this to your application's name JAVA\_VERSION: '11' # set this to the Java version to use on: push: branches: - main jobs: build: runs-on: ubuntu-latest steps: - uses: {% data reusables.actions.action-checkout %} - name: Set up Java version uses: {% data reusables.actions.action-setup-java %} with: java-version: {% raw %}${{ env.JAVA\_VERSION }}{% endraw %} cache: 'maven' - name: Build with Maven run: mvn clean install - name: Upload artifact for deployment job uses: {% data reusables.actions.action-upload-artifact %} with: name: java-app path: '{% raw %}${{ github.workspace }}{% endraw %}/target/\*.jar' deploy: runs-on: ubuntu-latest needs: build environment: name: 'production' url: {% raw %}${{ steps.deploy-to-webapp.outputs.webapp-url }}{% endraw %} steps: - name: Download artifact from build job uses: {% data reusables.actions.action-download-artifact %} with: name: java-app - name: Deploy to Azure Web App id: deploy-to-webapp uses: azure/webapps-deploy@85270a1854658d167ab239bce43949edb336fa7c with: app-name: {% raw %}${{ env.AZURE\_WEBAPP\_NAME }}{% endraw %} publish-profile: {% raw %}${{ secrets.AZURE\_WEBAPP\_PUBLISH\_PROFILE }}{% endraw %} package: '\*.jar' ``` ## Further reading \* For the original workflow template, see [`azure-webapps-java-jar.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-webapps-java-jar.yml) in the {% data variables.product.prodname\_actions %} `starter-workflows` repository. \* The action used to deploy the web app is the official Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) action. \* For more examples of GitHub Action workflows that deploy to Azure, see the [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) repository. | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/deploy-to-third-party-platforms/java-to-azure-app-service.md | main | github-actions | [
-0.023574229329824448,
-0.022617654874920845,
-0.06236788257956505,
-0.0313413068652153,
-0.06009119376540184,
0.04274579510092735,
0.0864434614777565,
0.027908222749829292,
-0.06477056443691254,
0.059340398758649826,
0.027074122801423073,
-0.05389050766825676,
0.1076601892709732,
0.045045... | -0.017509 |
## Prerequisites Before creating your {% data variables.product.prodname\_actions %} workflow, you will first need to complete the following setup steps: {% data reusables.actions.create-azure-app-plan %} 1. Create a web app. For example, you can use the Azure CLI to create an Azure App Service web app with a PHP runtime: ```bash copy az webapp create \ --name MY\_WEBAPP\_NAME \ --plan MY\_APP\_SERVICE\_PLAN \ --resource-group MY\_RESOURCE\_GROUP \ --runtime "php|7.4" ``` In the command above, replace the parameters with your own values, where `MY\_WEBAPP\_NAME` is a new name for the web app. {% data reusables.actions.create-azure-publish-profile %} 1. Optionally, configure a deployment environment. {% data reusables.actions.about-environments %} ## Creating the workflow Once you've completed the prerequisites, you can proceed with creating the workflow. The following example workflow demonstrates how to build and deploy a PHP project to Azure App Service when there is a push to the `main` branch. Ensure that you set `AZURE\_WEBAPP\_NAME` in the workflow `env` key to the name of the web app you created. If the path to your project is not the repository root, change `AZURE\_WEBAPP\_PACKAGE\_PATH` to the path to your project. If you use a version of PHP other than `8.x`, change`PHP\_VERSION` to the version that you use. {% data reusables.actions.delete-env-key %} ```yaml copy {% data reusables.actions.actions-not-certified-by-github-comment %} {% data reusables.actions.actions-use-sha-pinning-comment %} name: Build and deploy PHP app to Azure Web App env: AZURE\_WEBAPP\_NAME: MY\_WEBAPP\_NAME # set this to your application's name AZURE\_WEBAPP\_PACKAGE\_PATH: '.' # set this to the path to your web app project, defaults to the repository root PHP\_VERSION: '8.x' # set this to the PHP version to use on: push: branches: - main jobs: build: runs-on: ubuntu-latest steps: - uses: {% data reusables.actions.action-checkout %} - name: Setup PHP uses: shivammathur/setup-php@1f2e3d4c5b6a7f8e9d0c1b2a3e4f5d6c7b8a9e0f with: php-version: {% raw %}${{ env.PHP\_VERSION }}{% endraw %} - name: Check if composer.json exists id: check\_files uses: andstor/file-existence-action@2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b with: files: 'composer.json' - name: Get Composer Cache Directory id: composer-cache if: steps.check\_files.outputs.files\_exists == 'true' run: | echo "dir=$(composer config cache-files-dir)" >> $GITHUB\_OUTPUT - name: Set up dependency caching for faster installs uses: {% data reusables.actions.action-cache %} if: steps.check\_files.outputs.files\_exists == 'true' with: path: {% raw %}${{ steps.composer-cache.outputs.dir }}{% endraw %} key: {% raw %}${{ runner.os }}-composer-${{ hashFiles('\*\*/composer.lock') }}{% endraw %} restore-keys: | {% raw %}${{ runner.os }}-composer-{% endraw %} - name: Run composer install if composer.json exists if: steps.check\_files.outputs.files\_exists == 'true' run: composer validate --no-check-publish && composer install --prefer-dist --no-progress - name: Upload artifact for deployment job uses: {% data reusables.actions.action-upload-artifact %} with: name: php-app path: . deploy: runs-on: ubuntu-latest needs: build environment: name: 'production' url: {% raw %}${{ steps.deploy-to-webapp.outputs.webapp-url }}{% endraw %} steps: - name: Download artifact from build job uses: {% data reusables.actions.action-download-artifact %} with: name: php-app - name: 'Deploy to Azure Web App' id: deploy-to-webapp uses: azure/webapps-deploy@85270a1854658d167ab239bce43949edb336fa7c with: app-name: {% raw %}${{ env.AZURE\_WEBAPP\_NAME }}{% endraw %} publish-profile: {% raw %}${{ secrets.AZURE\_WEBAPP\_PUBLISH\_PROFILE }}{% endraw %} package: . ``` ## Further reading \* For the original workflow template, see [`azure-webapps-php.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-webapps-php.yml) in the {% data variables.product.prodname\_actions %} `starter-workflows` repository. \* The action used to deploy the web app is the official Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) action. \* For more examples of GitHub Action workflows that deploy to Azure, see the [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) repository. | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/deploy-to-third-party-platforms/php-to-azure-app-service.md | main | github-actions | [
-0.0041356878355145454,
-0.03630531206727028,
-0.08601061254739761,
0.00043294185888953507,
-0.045524608343839645,
0.047098953276872635,
0.09240993112325668,
0.014411676675081253,
-0.061006009578704834,
0.10899996012449265,
0.03747883811593056,
-0.0722225159406662,
0.07477349042892456,
0.0... | -0.018824 |
## Prerequisites Before creating your {% data variables.product.prodname\_actions %} workflow, you will first need to complete the following setup steps: 1. Create a target AKS cluster and an Azure Container Registry (ACR). For more information, see [Quickstart: Deploy an AKS cluster by using the Azure portal - Azure Kubernetes Service](https://docs.microsoft.com/azure/aks/kubernetes-walkthrough-portal) and [Quickstart - Create registry in portal - Azure Container Registry](https://docs.microsoft.com/azure/container-registry/container-registry-get-started-portal) in the Azure documentation. 1. Create a secret called `AZURE\_CREDENTIALS` to store your Azure credentials. For more information about how to find this information and structure the secret, see [the `Azure/login` action documentation](https://github.com/Azure/login#configure-a-service-principal-with-a-secret). ## Creating the workflow Once you've completed the prerequisites, you can proceed with creating the workflow. The following example workflow demonstrates how to build and deploy a project to Azure Kubernetes Service when code is pushed to your repository. Under the workflow `env` key, change the following values: \* `AZURE\_CONTAINER\_REGISTRY` to the name of your container registry \* `PROJECT\_NAME` to the name of your project \* `RESOURCE\_GROUP` to the resource group containing your AKS cluster \* `CLUSTER\_NAME` to the name of your AKS cluster This workflow uses the `helm` render engine for the [`azure/k8s-bake` action](https://github.com/Azure/k8s-bake). If you will use the `helm` render engine, change the value of `CHART\_PATH` to the path to your helm file. Change `CHART\_OVERRIDE\_PATH` to an array of override file paths. If you use a different render engine, update the input parameters sent to the `azure/k8s-bake` action. ```yaml copy {% data reusables.actions.actions-not-certified-by-github-comment %} {% data reusables.actions.actions-use-sha-pinning-comment %} name: Build and deploy to Azure Kubernetes Service env: AZURE\_CONTAINER\_REGISTRY: MY\_REGISTRY\_NAME # set this to the name of your container registry PROJECT\_NAME: MY\_PROJECT\_NAME # set this to your project's name RESOURCE\_GROUP: MY\_RESOURCE\_GROUP # set this to the resource group containing your AKS cluster CLUSTER\_NAME: MY\_CLUSTER\_NAME # set this to the name of your AKS cluster REGISTRY\_URL: MY\_REGISTRY\_URL # set this to the URL of your registry # If you bake using helm: CHART\_PATH: MY\_HELM\_FILE # set this to the path to your helm file CHART\_OVERRIDE\_PATH: MY\_OVERRIDE\_FILES # set this to an array of override file paths on: [push] jobs: build: runs-on: ubuntu-latest steps: - uses: {% data reusables.actions.action-checkout %} - name: Azure Login uses: azure/login@14a755a4e2fd6dff25794233def4f2cf3f866955 with: creds: {% raw %}${{ secrets.AZURE\_CREDENTIALS }}{% endraw %} - name: Build image on ACR uses: azure/CLI@61bb69d64d613b52663984bf12d6bac8fd7b3cc8 with: azcliversion: 2.29.1 inlineScript: | az configure --defaults acr={% raw %}${{ env.AZURE\_CONTAINER\_REGISTRY }}{% endraw %} az acr build -t -t {% raw %}${{ env.REGISTRY\_URL }}{% endraw %}/{% raw %}${{ env.PROJECT\_NAME }}{% endraw %}:{% raw %}${{ github.sha }}{% endraw %} - name: Gets K8s context uses: azure/aks-set-context@94ccc775c1997a3fcfbfbce3c459fec87e0ab188 with: creds: {% raw %}${{ secrets.AZURE\_CREDENTIALS }}{% endraw %} resource-group: {% raw %}${{ env.RESOURCE\_GROUP }}{% endraw %} cluster-name: {% raw %}${{ env.CLUSTER\_NAME }}{% endraw %} id: login - name: Configure deployment uses: azure/k8s-bake@61041e8c2f75c1f01186c8f05fb8b24e1fc507d8 with: renderEngine: 'helm' helmChart: {% raw %}${{ env.CHART\_PATH }}{% endraw %} overrideFiles: {% raw %}${{ env.CHART\_OVERRIDE\_PATH }}{% endraw %} overrides: | replicas:2 helm-version: 'latest' id: bake - name: Deploys application uses: Azure/k8s-deploy@dd4bbd13a5abd2fc9ca8bdcb8aee152bb718fa78 with: manifests: {% raw %}${{ steps.bake.outputs.manifestsBundle }}{% endraw %} images: | {% raw %}${{ env.AZURE\_CONTAINER\_REGISTRY }}{% endraw %}.azurecr.io/{% raw %}${{ env.PROJECT\_NAME }}{% endraw %}:{% raw %}${{ github.sha }}{% endraw %} imagepullsecrets: | {% raw %}${{ env.PROJECT\_NAME }}{% endraw %} ``` ## Further reading \* For the original workflow template, see [`azure-kubernetes-service.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-kubernetes-service.yml) in the {% data variables.product.prodname\_actions %} `starter-workflows` repository. \* The actions used to in this workflow are the official Azure [`Azure/login`](https://github.com/Azure/login),[`Azure/aks-set-context`](https://github.com/Azure/aks-set-context), [`Azure/CLI`](https://github.com/Azure/CLI), [`Azure/k8s-bake`](https://github.com/Azure/k8s-bake), and [`Azure/k8s-deploy`](https://github.com/Azure/k8s-deploy)actions. \* For more examples of GitHub Action workflows that deploy to Azure, see the [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) repository. | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/deploy-to-third-party-platforms/azure-kubernetes-service.md | main | github-actions | [
0.004913253244012594,
-0.03173493966460228,
-0.0937141552567482,
0.0015080192824825644,
-0.06516459584236145,
0.11125326156616211,
0.10380654782056808,
-0.017105884850025177,
0.024657923728227615,
0.12074647098779678,
-0.018741527572274208,
-0.0454389825463295,
0.05598631873726845,
0.04957... | 0.070003 |
to in this workflow are the official Azure [`Azure/login`](https://github.com/Azure/login),[`Azure/aks-set-context`](https://github.com/Azure/aks-set-context), [`Azure/CLI`](https://github.com/Azure/CLI), [`Azure/k8s-bake`](https://github.com/Azure/k8s-bake), and [`Azure/k8s-deploy`](https://github.com/Azure/k8s-deploy)actions. \* For more examples of GitHub Action workflows that deploy to Azure, see the [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) repository. | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/deploy-to-third-party-platforms/azure-kubernetes-service.md | main | github-actions | [
-0.018823273479938507,
-0.025411393493413925,
-0.03590543568134308,
-0.01879737712442875,
-0.05222379043698311,
0.021317509934306145,
0.08030655980110168,
-0.07821541279554367,
0.07509348541498184,
0.10198727995157242,
-0.012718189507722855,
0.007644711993634701,
0.06308205425739288,
0.024... | 0.153133 |
## Prerequisites Before creating your {% data variables.product.prodname\_actions %} workflow, you will first need to complete the following setup steps: {% data reusables.actions.create-azure-app-plan %} 1. Create a web app. For example, you can use the Azure CLI to create an Azure App Service web app with a .NET runtime: ```bash copy az webapp create \ --name MY\_WEBAPP\_NAME \ --plan MY\_APP\_SERVICE\_PLAN \ --resource-group MY\_RESOURCE\_GROUP \ --runtime "DOTNET|5.0" ``` In the command above, replace the parameters with your own values, where `MY\_WEBAPP\_NAME` is a new name for the web app. {% data reusables.actions.create-azure-publish-profile %} 1. Optionally, configure a deployment environment. {% data reusables.actions.about-environments %} ## Creating the workflow Once you've completed the prerequisites, you can proceed with creating the workflow. The following example workflow demonstrates how to build and deploy a .NET project to Azure App Service when there is a push to the `main` branch. Ensure that you set `AZURE\_WEBAPP\_NAME` in the workflow `env` key to the name of the web app you created. If the path to your project is not the repository root, change `AZURE\_WEBAPP\_PACKAGE\_PATH`. If you use a version of .NET other than `5`, change `DOTNET\_VERSION`. {% data reusables.actions.delete-env-key %} ```yaml copy {% data reusables.actions.actions-not-certified-by-github-comment %} {% data reusables.actions.actions-use-sha-pinning-comment %} name: Build and deploy ASP.Net Core app to an Azure Web App env: AZURE\_WEBAPP\_NAME: MY\_WEBAPP\_NAME # set this to your application's name AZURE\_WEBAPP\_PACKAGE\_PATH: '.' # set this to the path to your web app project, defaults to the repository root DOTNET\_VERSION: '5' # set this to the .NET Core version to use on: push: branches: - main jobs: build: runs-on: ubuntu-latest steps: - uses: {% data reusables.actions.action-checkout %} - name: Set up .NET Core uses: {% data reusables.actions.action-setup-dotnet %} with: dotnet-version: {% raw %}${{ env.DOTNET\_VERSION }}{% endraw %} - name: Set up dependency caching for faster builds uses: {% data reusables.actions.action-cache %} with: path: ~/.nuget/packages key: {% raw %}${{ runner.os }}-nuget-${{ hashFiles('\*\*/packages.lock.json') }}{% endraw %} restore-keys: | {% raw %}${{ runner.os }}-nuget-{% endraw %} - name: Build with dotnet run: dotnet build --configuration Release - name: dotnet publish run: dotnet publish -c Release -o {% raw %}${{env.DOTNET\_ROOT}}{% endraw %}/myapp - name: Upload artifact for deployment job uses: {% data reusables.actions.action-upload-artifact %} with: name: .net-app path: {% raw %}${{env.DOTNET\_ROOT}}{% endraw %}/myapp deploy: runs-on: ubuntu-latest needs: build environment: name: 'production' url: {% raw %}${{ steps.deploy-to-webapp.outputs.webapp-url }}{% endraw %} steps: - name: Download artifact from build job uses: {% data reusables.actions.action-download-artifact %} with: name: .net-app - name: Deploy to Azure Web App id: deploy-to-webapp uses: azure/webapps-deploy@85270a1854658d167ab239bce43949edb336fa7c with: app-name: {% raw %}${{ env.AZURE\_WEBAPP\_NAME }}{% endraw %} publish-profile: {% raw %}${{ secrets.AZURE\_WEBAPP\_PUBLISH\_PROFILE }}{% endraw %} package: {% raw %}${{ env.AZURE\_WEBAPP\_PACKAGE\_PATH }}{% endraw %} ``` ## Further reading \* For the original workflow template, see [`azure-webapps-dotnet-core.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-webapps-dotnet-core.yml) in the {% data variables.product.prodname\_actions %} `starter-workflows` repository. \* The action used to deploy the web app is the official Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) action. \* For more examples of GitHub Action workflows that deploy to Azure, see the [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) repository. | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/deploy-to-third-party-platforms/net-to-azure-app-service.md | main | github-actions | [
-0.02190760336816311,
-0.055470310151576996,
-0.0513426810503006,
-0.017870472744107246,
-0.029527578502893448,
0.02038569748401642,
0.11276727169752121,
0.021963875740766525,
-0.06798113882541656,
0.11946775764226913,
0.008649230003356934,
-0.049489811062812805,
0.09881962090730667,
0.067... | -0.002172 |
## Prerequisites Before creating your {% data variables.product.prodname\_actions %} workflow, you will first need to complete the following setup steps: 1. Create an Azure Static Web App using the 'Other' option for deployment source. For more information, see [Quickstart: Building your first static site in the Azure portal](https://docs.microsoft.com/azure/static-web-apps/get-started-portal) in the Azure documentation. 1. Create a secret called `AZURE\_STATIC\_WEB\_APPS\_API\_TOKEN` with the value of your static web app deployment token. For more information about how to find your deployment token, see [Reset deployment tokens in Azure Static Web Apps](https://docs.microsoft.com/azure/static-web-apps/deployment-token-management) in the Azure documentation. ## Creating the workflow Once you've completed the prerequisites, you can proceed with creating the workflow. The following example workflow demonstrates how to build and deploy an Azure static web app when there is a push to the `main` branch or when a pull request targeting `main` is opened, synchronized, or reopened. The workflow also tears down the corresponding pre-production deployment when a pull request targeting `main` is closed. Under the workflow `env` key, change the following values: \* `APP\_LOCATION` to the location of your client code \* `API\_LOCATION` to the location of your API source code. If `API\_LOCATION` is not relevant, you can delete the variable and the lines where it is used. \* `OUTPUT\_LOCATION` to the location of your client code build output For more information about these values, see [Build configuration for Azure Static Web Apps](https://docs.microsoft.com/azure/static-web-apps/build-configuration?tabs=github-actions) in the Azure documentation. ```yaml copy {% data reusables.actions.actions-not-certified-by-github-comment %} {% data reusables.actions.actions-use-sha-pinning-comment %} name: Deploy web app to Azure Static Web Apps env: APP\_LOCATION: "/" # location of your client code API\_LOCATION: "api" # location of your api source code - optional OUTPUT\_LOCATION: "build" # location of client code build output on: push: branches: - main pull\_request: types: [opened, synchronize, reopened, closed] branches: - main permissions: issues: write contents: read pull-requests: write jobs: build\_and\_deploy: if: github.event\_name == 'push' || (github.event\_name == 'pull\_request' && github.event.action != 'closed') runs-on: ubuntu-latest name: Build and Deploy steps: - uses: {% data reusables.actions.action-checkout %} with: submodules: true - name: Build And Deploy uses: Azure/static-web-apps-deploy@1a947af9992250f3bc2e68ad0754c0b0c11566c9 with: azure\_static\_web\_apps\_api\_token: {% raw %}${{ secrets.AZURE\_STATIC\_WEB\_APPS\_API\_TOKEN }}{% endraw %} repo\_token: {% raw %}${{ secrets.GITHUB\_TOKEN }}{% endraw %} action: "upload" app\_location: {% raw %}${{ env.APP\_LOCATION }}{% endraw %} api\_location: {% raw %}${{ env.API\_LOCATION }}{% endraw %} output\_location: {% raw %}${{ env.OUTPUT\_LOCATION }}{% endraw %} close\_pull\_request: if: github.event\_name == 'pull\_request' && github.event.action == 'closed' runs-on: ubuntu-latest name: Close Pull Request steps: - name: Close Pull Request uses: Azure/static-web-apps-deploy@1a947af9992250f3bc2e68ad0754c0b0c11566c9 with: azure\_static\_web\_apps\_api\_token: {% raw %}${{ secrets.AZURE\_STATIC\_WEB\_APPS\_API\_TOKEN }}{% endraw %} action: "close" ``` ## Further reading \* For the original workflow template, see [`azure-staticwebapp.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-staticwebapp.yml) in the {% data variables.product.prodname\_actions %} `starter-workflows` repository. \* The action used to deploy the web app is the official Azure [`Azure/static-web-apps-deploy`](https://github.com/Azure/static-web-apps-deploy) action. \* For more examples of GitHub Action workflows that deploy to Azure, see the [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) repository. | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/deploy-to-third-party-platforms/azure-static-web-app.md | main | github-actions | [
0.016295254230499268,
-0.07903627306222916,
-0.05692296102643013,
-0.035137373954057693,
-0.044860031455755234,
0.027736514806747437,
0.057416800409555435,
0.0259001012891531,
-0.03388407826423645,
0.11090996116399765,
0.04547503590583801,
-0.06344356387853622,
0.07589594274759293,
0.07468... | 0.004347 |
## Prerequisites Before you proceed with creating the workflow, you will need to complete the following steps for your Kubernetes project. This guide assumes the root of your project already has a `Dockerfile` and a Kubernetes Deployment configuration file. ### Creating a GKE cluster To create the GKE cluster, you will first need to authenticate using the `gcloud` CLI. For more information on this step, see the following articles: \* [`gcloud auth login`](https://cloud.google.com/sdk/gcloud/reference/auth/login) \* [`gcloud` CLI](https://cloud.google.com/sdk/gcloud/reference) \* [`gcloud` CLI and Cloud SDK](https://cloud.google.com/sdk/gcloud#the\_gcloud\_cli\_and\_cloud\_sdk) For example: ```shell copy $ gcloud container clusters create $GKE\_CLUSTER \ --project=$GKE\_PROJECT \ --zone=$GKE\_ZONE ``` ### Enabling the APIs Enable the Kubernetes Engine and Container Registry APIs. For example: ```shell copy $ gcloud services enable \ containerregistry.googleapis.com \ container.googleapis.com ``` ### Configuring a service account and storing its credentials This procedure demonstrates how to create the service account for your GKE integration. It explains how to create the account, add roles to it, retrieve its keys, and store them as a base64-encoded {% ifversion fpt or ghec %}encrypted {% endif %}repository secret named `GKE\_SA\_KEY`. 1. Create a new service account: ```shell copy gcloud iam service-accounts create $SA\_NAME ``` 1. Retrieve the email address of the service account you just created: ```shell copy gcloud iam service-accounts list ``` 1. Add roles to the service account. > [!NOTE] > Apply more restrictive roles to suit your requirements. ```shell copy gcloud projects add-iam-policy-binding $GKE\_PROJECT \ --member=serviceAccount:$SA\_EMAIL \ --role=roles/container.admin gcloud projects add-iam-policy-binding $GKE\_PROJECT \ --member=serviceAccount:$SA\_EMAIL \ --role=roles/storage.admin gcloud projects add-iam-policy-binding $GKE\_PROJECT \ --member=serviceAccount:$SA\_EMAIL \ --role=roles/container.clusterViewer ``` 1. Download the JSON keyfile for the service account: ```shell copy gcloud iam service-accounts keys create key.json --iam-account=$SA\_EMAIL ``` 1. Store the service account key as a secret named `GKE\_SA\_KEY`: ```shell copy export GKE\_SA\_KEY=$(cat key.json | base64) ``` For more information about how to store a secret, see [AUTOTITLE](/actions/security-guides/using-secrets-in-github-actions). ### Storing your project name Store the name of your project as a secret named `GKE\_PROJECT`. For more information about how to store a secret, see [AUTOTITLE](/actions/security-guides/using-secrets-in-github-actions). ### (Optional) Configuring kustomize Kustomize is an optional tool used for managing YAML specs. After creating a `kustomization` file, the workflow below can be used to dynamically set fields of the image and pipe in the result to `kubectl`. For more information, see [kustomize usage](https://github.com/kubernetes-sigs/kustomize#usage). ### (Optional) Configure a deployment environment {% data reusables.actions.about-environments %} ## Creating the workflow Once you've completed the prerequisites, you can proceed with creating the workflow. The following example workflow demonstrates how to build a container image and push it to GCR. It then uses the Kubernetes tools (such as `kubectl` and `kustomize`) to pull the image into the cluster deployment. Under the `env` key, change the value of `GKE\_CLUSTER` to the name of your cluster, `GKE\_ZONE` to your cluster zone, `DEPLOYMENT\_NAME` to the name of your deployment, and `IMAGE` to the name of your image. {% data reusables.actions.delete-env-key %} ```yaml copy {% data reusables.actions.actions-not-certified-by-github-comment %} {% data reusables.actions.actions-use-sha-pinning-comment %} name: Build and Deploy to GKE on: push: branches: - main env: PROJECT\_ID: {% raw %}${{ secrets.GKE\_PROJECT }}{% endraw %} GKE\_CLUSTER: cluster-1 # Add your cluster name here. GKE\_ZONE: us-central1-c # Add your cluster zone here. DEPLOYMENT\_NAME: gke-test # Add your deployment name here. IMAGE: static-site jobs: setup-build-publish-deploy: name: Setup, Build, Publish, and Deploy runs-on: ubuntu-latest environment: production steps: - name: Checkout uses: {% data reusables.actions.action-checkout %} # Setup gcloud CLI - uses: google-github-actions/setup-gcloud@1bee7de035d65ec5da40a31f8589e240eba8fde5 with: service\_account\_key: {% raw %}${{ secrets.GKE\_SA\_KEY }}{% endraw %} project\_id: {% raw %}${{ secrets.GKE\_PROJECT }}{% endraw %} # Configure Docker to use the gcloud command-line tool as a credential # helper for authentication - run: |- gcloud --quiet auth configure-docker # | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/deploy-to-third-party-platforms/google-kubernetes-engine.md | main | github-actions | [
-0.01768512651324272,
-0.019442718476057053,
0.017935071140527725,
-0.08380752801895142,
-0.06722794473171234,
-0.020907506346702576,
0.02797734923660755,
0.004798016510903835,
0.03620283678174019,
0.02256316877901554,
-0.05275465175509453,
-0.14870823919773102,
0.07272941619157791,
-0.024... | 0.02976 |
reusables.actions.action-checkout %} # Setup gcloud CLI - uses: google-github-actions/setup-gcloud@1bee7de035d65ec5da40a31f8589e240eba8fde5 with: service\_account\_key: {% raw %}${{ secrets.GKE\_SA\_KEY }}{% endraw %} project\_id: {% raw %}${{ secrets.GKE\_PROJECT }}{% endraw %} # Configure Docker to use the gcloud command-line tool as a credential # helper for authentication - run: |- gcloud --quiet auth configure-docker # Get the GKE credentials so we can deploy to the cluster - uses: google-github-actions/get-gke-credentials@db150f2cc60d1716e61922b832eae71d2a45938f with: cluster\_name: {% raw %}${{ env.GKE\_CLUSTER }}{% endraw %} location: {% raw %}${{ env.GKE\_ZONE }}{% endraw %} credentials: {% raw %}${{ secrets.GKE\_SA\_KEY }}{% endraw %} # Build the Docker image - name: Build run: |- docker build \ --tag "gcr.io/$PROJECT\_ID/$IMAGE:$GITHUB\_SHA" \ --build-arg GITHUB\_SHA="$GITHUB\_SHA" \ --build-arg GITHUB\_REF="$GITHUB\_REF" \ . # Push the Docker image to Google Container Registry - name: Publish run: |- docker push "gcr.io/$PROJECT\_ID/$IMAGE:$GITHUB\_SHA" # Set up kustomize - name: Set up Kustomize run: |- curl -sfLo kustomize https://github.com/kubernetes-sigs/kustomize/releases/download/v3.1.0/kustomize\_3.1.0\_linux\_amd64 chmod u+x ./kustomize # Deploy the Docker image to the GKE cluster - name: Deploy run: |- ./kustomize edit set image gcr.io/PROJECT\_ID/IMAGE:TAG=gcr.io/$PROJECT\_ID/$IMAGE:$GITHUB\_SHA ./kustomize build . | kubectl apply -f - kubectl rollout status deployment/$DEPLOYMENT\_NAME kubectl get services -o wide ``` ## Further reading For more information on the tools used in these examples, see the following documentation: \* For the full workflow template, see the ["Build and Deploy to GKE" workflow](https://github.com/actions/starter-workflows/blob/main/deployments/google.yml). \* The Kubernetes YAML customization engine: [Kustomize](https://kustomize.io/). \* [Deploying a containerized web application](https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app) in the Google Kubernetes Engine documentation. | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/deploy-to-third-party-platforms/google-kubernetes-engine.md | main | github-actions | [
-0.03395630791783333,
-0.023037733510136604,
-0.00923854112625122,
-0.029723910614848137,
-0.018672168254852295,
-0.019140250980854034,
0.004991862922906876,
-0.030032001435756683,
-0.021204141899943352,
0.05539429932832718,
-0.0096212737262249,
-0.09114094078540802,
0.07925744354724884,
-... | -0.019891 |
## Prerequisites Before creating your {% data variables.product.prodname\_actions %} workflow, you will first need to complete the following setup steps: {% data reusables.actions.create-azure-app-plan %} 1. Create a web app. For example, you can use the Azure CLI to create an Azure App Service web app with a Node.js runtime: ```bash copy az webapp create \ --name MY\_WEBAPP\_NAME \ --plan MY\_APP\_SERVICE\_PLAN \ --resource-group MY\_RESOURCE\_GROUP \ --runtime "NODE|14-lts" ``` In the command above, replace the parameters with your own values, where `MY\_WEBAPP\_NAME` is a new name for the web app. {% data reusables.actions.create-azure-publish-profile %} 1. Optionally, configure a deployment environment. {% data reusables.actions.about-environments %} ## Creating the workflow Once you've completed the prerequisites, you can proceed with creating the workflow. The following example workflow demonstrates how to build, test, and deploy the Node.js project to Azure App Service when there is a push to the `main` branch. Ensure that you set `AZURE\_WEBAPP\_NAME` in the workflow `env` key to the name of the web app you created. If the path to your project is not the repository root, change `AZURE\_WEBAPP\_PACKAGE\_PATH` to your project path. If you use a version of Node.js other than `10.x`, change `NODE\_VERSION` to the version that you use. {% data reusables.actions.delete-env-key %} ```yaml copy {% data reusables.actions.actions-not-certified-by-github-comment %} {% data reusables.actions.actions-use-sha-pinning-comment %} on: push: branches: - main env: AZURE\_WEBAPP\_NAME: MY\_WEBAPP\_NAME # set this to your application's name AZURE\_WEBAPP\_PACKAGE\_PATH: '.' # set this to the path to your web app project, defaults to the repository root NODE\_VERSION: '14.x' # set this to the node version to use jobs: build: runs-on: ubuntu-latest steps: - uses: {% data reusables.actions.action-checkout %} - name: Set up Node.js uses: {% data reusables.actions.action-setup-node %} with: node-version: {% raw %}${{ env.NODE\_VERSION }}{% endraw %} cache: 'npm' - name: npm install, build, and test run: | npm install npm run build --if-present npm run test --if-present - name: Upload artifact for deployment job uses: {% data reusables.actions.action-upload-artifact %} with: name: node-app path: . deploy: runs-on: ubuntu-latest needs: build environment: name: 'production' url: {% raw %}${{ steps.deploy-to-webapp.outputs.webapp-url }}{% endraw %} steps: - name: Download artifact from build job uses: {% data reusables.actions.action-download-artifact %} with: name: node-app - name: 'Deploy to Azure WebApp' id: deploy-to-webapp uses: azure/webapps-deploy@85270a1854658d167ab239bce43949edb336fa7c with: app-name: {% raw %}${{ env.AZURE\_WEBAPP\_NAME }}{% endraw %} publish-profile: {% raw %}${{ secrets.AZURE\_WEBAPP\_PUBLISH\_PROFILE }}{% endraw %} package: {% raw %}${{ env.AZURE\_WEBAPP\_PACKAGE\_PATH }}{% endraw %} ``` ## Further reading \* For the original workflow template, see [`azure-webapps-node.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-webapps-node.yml) in the {% data variables.product.prodname\_actions %} `starter-workflows` repository. \* The action used to deploy the web app is the official Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) action. \* For more examples of GitHub Action workflows that deploy to Azure, see the [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) repository. \* The [Create a Node.js web app in Azure](https://docs.microsoft.com/azure/app-service/quickstart-nodejs) quickstart in the Azure web app documentation demonstrates using {% data variables.product.prodname\_vscode %} with the [Azure App Service extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azureappservice). | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/deploy-to-third-party-platforms/nodejs-to-azure-app-service.md | main | github-actions | [
-0.01385961752384901,
-0.021333076059818268,
-0.0548614077270031,
0.011867196299135685,
-0.033676810562610626,
0.048996057361364365,
0.06738077849149704,
0.0407884456217289,
-0.04433269426226616,
0.10537438839673996,
0.018384834751486778,
-0.0422491654753685,
0.09302645176649094,
0.0497516... | -0.012929 |
## Prerequisites Before creating your {% data variables.product.prodname\_actions %} workflow, you will first need to complete the following setup steps for Amazon ECR and ECS: 1. Create an Amazon ECR repository to store your images. For example, using [the AWS CLI](https://aws.amazon.com/cli/): {% raw %} ```bash copy aws ecr create-repository \ --repository-name MY\_ECR\_REPOSITORY \ --region MY\_AWS\_REGION ``` {% endraw %} Ensure that you use the same Amazon ECR repository name (represented here by `MY\_ECR\_REPOSITORY`) for the `ECR\_REPOSITORY` variable in the workflow below. Ensure that you use the same AWS region value for the `AWS\_REGION` (represented here by `MY\_AWS\_REGION`) variable in the workflow below. 1. Create an Amazon ECS task definition, cluster, and service. For details, follow the [Getting started wizard on the Amazon ECS console](https://us-east-2.console.aws.amazon.com/ecs/home?region=us-east-2#/firstRun), or the [Getting started guide](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/getting-started-fargate.html) in the Amazon ECS documentation. Ensure that you note the names you set for the Amazon ECS service and cluster, and use them for the `ECS\_SERVICE` and `ECS\_CLUSTER` variables in the workflow below. 1. Store your Amazon ECS task definition as a JSON file in your {% data variables.product.company\_short %} repository. The format of the file should be the same as the output generated by: {% raw %} ```bash copy aws ecs register-task-definition --generate-cli-skeleton ``` {% endraw %} Ensure that you set the `ECS\_TASK\_DEFINITION` variable in the workflow below as the path to the JSON file. Ensure that you set the `CONTAINER\_NAME` variable in the workflow below as the container name in the `containerDefinitions` section of the task definition. 1. Create {% data variables.product.prodname\_actions %} secrets named `AWS\_ACCESS\_KEY\_ID` and `AWS\_SECRET\_ACCESS\_KEY` to store the values for your Amazon IAM access key. For more information on creating secrets for {% data variables.product.prodname\_actions %}, see [AUTOTITLE](/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository). See the documentation for each action used below for the recommended IAM policies for the IAM user, and methods for handling the access key credentials. 1. Optionally, configure a deployment environment. {% data reusables.actions.about-environments %} ## Creating the workflow Once you've completed the prerequisites, you can proceed with creating the workflow. The following example workflow demonstrates how to build a container image and push it to Amazon ECR. It then updates the task definition with the new image ID, and deploys the task definition to Amazon ECS. Ensure that you provide your own values for all the variables in the `env` key of the workflow. {% data reusables.actions.delete-env-key %} ```yaml copy {% data reusables.actions.actions-not-certified-by-github-comment %} {% data reusables.actions.actions-use-sha-pinning-comment %} name: Deploy to Amazon ECS on: push: branches: - main env: AWS\_REGION: MY\_AWS\_REGION # set this to your preferred AWS region, e.g. us-west-1 ECR\_REPOSITORY: MY\_ECR\_REPOSITORY # set this to your Amazon ECR repository name ECS\_SERVICE: MY\_ECS\_SERVICE # set this to your Amazon ECS service name ECS\_CLUSTER: MY\_ECS\_CLUSTER # set this to your Amazon ECS cluster name ECS\_TASK\_DEFINITION: MY\_ECS\_TASK\_DEFINITION # set this to the path to your Amazon ECS task definition # file, e.g. .aws/task-definition.json CONTAINER\_NAME: MY\_CONTAINER\_NAME # set this to the name of the container in the # containerDefinitions section of your task definition jobs: deploy: name: Deploy runs-on: ubuntu-latest environment: production steps: - name: Checkout uses: {% data reusables.actions.action-checkout %} {% raw %}- name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@0e613a0980cbf65ed5b322eb7a1e075d28913a83 with: aws-access-key-id: ${{ secrets.AWS\_ACCESS\_KEY\_ID }} aws-secret-access-key: ${{ secrets.AWS\_SECRET\_ACCESS\_KEY }} aws-region: ${{ env.AWS\_REGION }} - name: Login to Amazon ECR id: login-ecr uses: aws-actions/amazon-ecr-login@62f4f872db3836360b72999f4b87f1ff13310f3a - name: Build, tag, and push image to Amazon ECR id: build-image env: ECR\_REGISTRY: ${{ steps.login-ecr.outputs.registry }} IMAGE\_TAG: ${{ github.sha }} run: | # Build a docker container and # push it to ECR so that it can # be deployed to ECS. docker build -t $ECR\_REGISTRY/$ECR\_REPOSITORY:$IMAGE\_TAG . docker push $ECR\_REGISTRY/$ECR\_REPOSITORY:$IMAGE\_TAG echo "image=$ECR\_REGISTRY/$ECR\_REPOSITORY:$IMAGE\_TAG" >> $GITHUB\_OUTPUT - | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/deploy-to-third-party-platforms/amazon-elastic-container-service.md | main | github-actions | [
0.02774750255048275,
-0.030039159581065178,
-0.03434453159570694,
-0.030080337077379227,
0.06273043155670166,
0.019976017996668816,
0.01792222261428833,
0.045245856046676636,
-0.010873745195567608,
0.04275459423661232,
0.05005490034818649,
-0.07335545867681503,
0.08256737887859344,
0.01525... | 0.00153 |
image to Amazon ECR id: build-image env: ECR\_REGISTRY: ${{ steps.login-ecr.outputs.registry }} IMAGE\_TAG: ${{ github.sha }} run: | # Build a docker container and # push it to ECR so that it can # be deployed to ECS. docker build -t $ECR\_REGISTRY/$ECR\_REPOSITORY:$IMAGE\_TAG . docker push $ECR\_REGISTRY/$ECR\_REPOSITORY:$IMAGE\_TAG echo "image=$ECR\_REGISTRY/$ECR\_REPOSITORY:$IMAGE\_TAG" >> $GITHUB\_OUTPUT - name: Fill in the new image ID in the Amazon ECS task definition id: task-def uses: aws-actions/amazon-ecs-render-task-definition@c804dfbdd57f713b6c079302a4c01db7017a36fc with: task-definition: ${{ env.ECS\_TASK\_DEFINITION }} container-name: ${{ env.CONTAINER\_NAME }} image: ${{ steps.build-image.outputs.image }} - name: Deploy Amazon ECS task definition uses: aws-actions/amazon-ecs-deploy-task-definition@df9643053eda01f169e64a0e60233aacca83799a with: task-definition: ${{ steps.task-def.outputs.task-definition }} service: ${{ env.ECS\_SERVICE }} cluster: ${{ env.ECS\_CLUSTER }} wait-for-service-stability: true{% endraw %} ``` ## Further reading For the original workflow template, see [`aws.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/aws.yml) in the {% data variables.product.prodname\_actions %} `starter-workflows` repository. For more information on the services used in these examples, see the following documentation: \* [Security best practices in IAM](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html) in the Amazon AWS documentation. \* Official AWS [Configure AWS Credentials](https://github.com/aws-actions/configure-aws-credentials) action. \* Official AWS [Amazon ECR "Login"](https://github.com/aws-actions/amazon-ecr-login) action. \* Official AWS [Amazon ECS "Render Task Definition"](https://github.com/aws-actions/amazon-ecs-render-task-definition) action. \* Official AWS [Amazon ECS "Deploy Task Definition"](https://github.com/aws-actions/amazon-ecs-deploy-task-definition) action. | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/deploy-to-third-party-platforms/amazon-elastic-container-service.md | main | github-actions | [
0.024160193279385567,
0.04551033675670624,
-0.0258978009223938,
-0.024566438049077988,
0.09506309032440186,
-0.02535262517631054,
-0.005608714185655117,
0.043362684547901154,
0.0452822707593441,
0.0020840486977249384,
0.005727721378207207,
-0.12346377968788147,
0.049881868064403534,
0.0032... | 0.00615 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## Prerequisites You should be familiar with YAML and the syntax for {% data variables.product.prodname\_actions %}. For more information, see: \* [AUTOTITLE](/actions/learn-github-actions) \* [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions) You should have an understanding of Xcode app building and signing. For more information, see the [Apple developer documentation](https://developer.apple.com/documentation/). ## Creating secrets for your certificate and provisioning profile The signing process involves storing certificates and provisioning profiles, transferring them to the runner, importing them to the runner's keychain, and using them in your build. To use your certificate and provisioning profile on a runner, we strongly recommend that you use {% data variables.product.prodname\_dotcom %} secrets. For more information on creating secrets and using them in a workflow, see [AUTOTITLE](/actions/security-guides/using-secrets-in-github-actions). Create secrets in your repository or organization for the following items: \* Your Apple signing certificate. \* This is your `p12` certificate file. For more information on exporting your signing certificate from Xcode, see the [Xcode documentation](https://help.apple.com/xcode/mac/current/#/dev154b28f09). \* You should convert your certificate to Base64 when saving it as a secret. In this example, the secret is named `BUILD\_CERTIFICATE\_BASE64`. \* Use the following command to convert your certificate to Base64 and copy it to your clipboard: ```shell base64 -i BUILD\_CERTIFICATE.p12 | pbcopy ``` \* The password for your Apple signing certificate. \* In this example, the secret is named `P12\_PASSWORD`. \* Your Apple provisioning profile. \* For more information on exporting your provisioning profile from Xcode, see the [Xcode documentation](https://help.apple.com/xcode/mac/current/#/deva899b4fe5). \* You should convert your provisioning profile to Base64 when saving it as a secret. In this example, the secret is named `BUILD\_PROVISION\_PROFILE\_BASE64`. \* Use the following command to convert your provisioning profile to Base64 and copy it to your clipboard: ```shell base64 -i PROVISIONING\_PROFILE.mobileprovision | pbcopy ``` \* A keychain password. \* A new keychain will be created on the runner, so the password for the new keychain can be any new random string. In this example, the secret is named `KEYCHAIN\_PASSWORD`. ## Add a step to your workflow This example workflow includes a step that imports the Apple certificate and provisioning profile from the {% data variables.product.prodname\_dotcom %} secrets, and installs them on the runner. ```yaml copy name: App build on: push jobs: build\_with\_signing: runs-on: macos-latest steps: - name: Checkout repository uses: {% data reusables.actions.action-checkout %} - name: Install the Apple certificate and provisioning profile env: BUILD\_CERTIFICATE\_BASE64: {% raw %}${{ secrets.BUILD\_CERTIFICATE\_BASE64 }}{% endraw %} P12\_PASSWORD: {% raw %}${{ secrets.P12\_PASSWORD }}{% endraw %} BUILD\_PROVISION\_PROFILE\_BASE64: {% raw %}${{ secrets.BUILD\_PROVISION\_PROFILE\_BASE64 }}{% endraw %} KEYCHAIN\_PASSWORD: {% raw %}${{ secrets.KEYCHAIN\_PASSWORD }}{% endraw %} run: | # create variables CERTIFICATE\_PATH=$RUNNER\_TEMP/build\_certificate.p12 PP\_PATH=$RUNNER\_TEMP/build\_pp.mobileprovision KEYCHAIN\_PATH=$RUNNER\_TEMP/app-signing.keychain-db # import certificate and provisioning profile from secrets echo -n "$BUILD\_CERTIFICATE\_BASE64" | base64 --decode -o $CERTIFICATE\_PATH echo -n "$BUILD\_PROVISION\_PROFILE\_BASE64" | base64 --decode -o $PP\_PATH # create temporary keychain security create-keychain -p "$KEYCHAIN\_PASSWORD" $KEYCHAIN\_PATH security set-keychain-settings -lut 21600 $KEYCHAIN\_PATH security unlock-keychain -p "$KEYCHAIN\_PASSWORD" $KEYCHAIN\_PATH # import certificate to keychain security import $CERTIFICATE\_PATH -P "$P12\_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN\_PATH security set-key-partition-list -S apple-tool:,apple: -k "$KEYCHAIN\_PASSWORD" $KEYCHAIN\_PATH security list-keychain -d user -s $KEYCHAIN\_PATH # apply provisioning profile mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles cp $PP\_PATH ~/Library/MobileDevice/Provisioning\ Profiles - name: Build app # ... ``` > [!NOTE] > For iOS build targets, your provisioning profile should have the extension `.mobileprovision`. For macOS build targets, the extension should be `.provisionprofile`. The example workflow above should be updated to reflect your target platform. ## Required clean-up on self-hosted runners {% data variables.product.prodname\_dotcom %}-hosted runners are isolated virtual machines that are automatically destroyed at the end of the job execution. This means that the certificates and provisioning profile used on the runner during the job will be destroyed with the runner | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/deploy-to-third-party-platforms/sign-xcode-applications.md | main | github-actions | [
-0.021012622863054276,
-0.01943650096654892,
-0.054478373378515244,
-0.029418328776955605,
-0.012081650085747242,
0.02505163662135601,
0.07059823721647263,
0.11294786632061005,
-0.0519440658390522,
-0.036709047853946686,
0.03473613038659096,
-0.03960638493299484,
0.039196982979774475,
0.00... | 0.093801 |
your target platform. ## Required clean-up on self-hosted runners {% data variables.product.prodname\_dotcom %}-hosted runners are isolated virtual machines that are automatically destroyed at the end of the job execution. This means that the certificates and provisioning profile used on the runner during the job will be destroyed with the runner when the job is completed. On self-hosted runners, the `$RUNNER\_TEMP` directory is cleaned up at the end of the job execution, but the keychain and provisioning profile might still exist on the runner. If you use self-hosted runners, you should add a final step to your workflow to help ensure that these sensitive files are deleted at the end of the job. The workflow step shown below is an example of how to do this. {% raw %} ```yaml - name: Clean up keychain and provisioning profile if: ${{ always() }} run: | security delete-keychain $RUNNER\_TEMP/app-signing.keychain-db rm ~/Library/MobileDevice/Provisioning\ Profiles/build\_pp.mobileprovision ``` {% endraw %} | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/deploy-to-third-party-platforms/sign-xcode-applications.md | main | github-actions | [
-0.0011487897718325257,
0.059491854161024094,
-0.002816740656271577,
0.011012179777026176,
0.09483043849468231,
-0.09442716836929321,
-0.01932445913553238,
-0.003137757768854499,
-0.006403089500963688,
-0.002888893708586693,
0.046038344502449036,
0.019887009635567665,
0.05812092497944832,
... | 0.004554 |
## Prerequisites Before creating your {% data variables.product.prodname\_actions %} workflow, you will first need to complete the following setup steps: {% data reusables.actions.create-azure-app-plan %} 1. Create a web app. For example, you can use the Azure CLI to create an Azure App Service web app with a Python runtime: ```bash copy az webapp create \ --name MY\_WEBAPP\_NAME \ --plan MY\_APP\_SERVICE\_PLAN \ --resource-group MY\_RESOURCE\_GROUP \ --runtime "python|3.8" ``` In the command above, replace the parameters with your own values, where `MY\_WEBAPP\_NAME` is a new name for the web app. {% data reusables.actions.create-azure-publish-profile %} 1. Add an app setting called `SCM\_DO\_BUILD\_DURING\_DEPLOYMENT` and set the value to `1`. 1. Optionally, configure a deployment environment. {% data reusables.actions.about-environments %} ## Creating the workflow Once you've completed the prerequisites, you can proceed with creating the workflow. The following example workflow demonstrates how to build and deploy a Python project to Azure App Service when there is a push to the `main` branch. Ensure that you set `AZURE\_WEBAPP\_NAME` in the workflow `env` key to the name of the web app you created. If you use a version of Python other than `3.8`, change `PYTHON\_VERSION` to the version that you use. {% data reusables.actions.delete-env-key %} ```yaml copy {% data reusables.actions.actions-not-certified-by-github-comment %} {% data reusables.actions.actions-use-sha-pinning-comment %} name: Build and deploy Python app to Azure Web App env: AZURE\_WEBAPP\_NAME: MY\_WEBAPP\_NAME # set this to your application's name PYTHON\_VERSION: '3.8' # set this to the Python version to use on: push: branches: - main jobs: build: runs-on: ubuntu-latest steps: - uses: {% data reusables.actions.action-checkout %} - name: Set up Python version uses: {% data reusables.actions.action-setup-python %} with: python-version: {% raw %}${{ env.PYTHON\_VERSION }}{% endraw %} - name: Create and start virtual environment run: | python -m venv venv source venv/bin/activate - name: Set up dependency caching for faster installs uses: {% data reusables.actions.action-cache %} with: path: ~/.cache/pip key: {% raw %}${{ runner.os }}-pip-${{ hashFiles('\*\*/requirements.txt') }}{% endraw %} restore-keys: | {% raw %}${{ runner.os }}-pip-{% endraw %} - name: Install dependencies run: pip install -r requirements.txt # Optional: Add a step to run tests here (PyTest, Django test suites, etc.) - name: Upload artifact for deployment jobs uses: {% data reusables.actions.action-upload-artifact %} with: name: python-app path: | . !venv/ deploy: runs-on: ubuntu-latest needs: build environment: name: 'production' url: {% raw %}${{ steps.deploy-to-webapp.outputs.webapp-url }}{% endraw %} steps: - name: Download artifact from build job uses: {% data reusables.actions.action-download-artifact %} with: name: python-app path: . - name: 'Deploy to Azure Web App' id: deploy-to-webapp uses: azure/webapps-deploy@85270a1854658d167ab239bce43949edb336fa7c with: app-name: {% raw %}${{ env.AZURE\_WEBAPP\_NAME }}{% endraw %} publish-profile: {% raw %}${{ secrets.AZURE\_WEBAPP\_PUBLISH\_PROFILE }}{% endraw %} ``` ## Further reading \* For the original workflow template, see [`azure-webapps-python.yml`](https://github.com/actions/starter-workflows/blob/main/deployments/azure-webapps-python.yml) in the {% data variables.product.prodname\_actions %} `starter-workflows` repository. \* The action used to deploy the web app is the official Azure [`Azure/webapps-deploy`](https://github.com/Azure/webapps-deploy) action. \* For more examples of GitHub Action workflows that deploy to Azure, see the [actions-workflow-samples](https://github.com/Azure/actions-workflow-samples) repository. | https://github.com/github/docs/blob/main//content/actions/how-tos/deploy/deploy-to-third-party-platforms/python-to-azure-app-service.md | main | github-actions | [
-0.016460133716464043,
-0.044017571955919266,
-0.07950419187545776,
0.010221853852272034,
-0.05986644700169563,
0.0305589959025383,
0.07839769870042801,
0.02530631609261036,
-0.07306653261184692,
0.08641399443149567,
0.023184798657894135,
-0.04668321833014488,
0.10073813050985336,
0.052684... | -0.030635 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## Choosing and using a workflow template {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.actions.new-starter-workflow %} 1. The "Choose a workflow" page shows a selection of recommended workflow templates. Find the workflow template that you want to use, then click \*\*Configure\*\*. To help you find the workflow template that you want, you can search for keywords or filter by category. 1. If the workflow template contains comments detailing additional setup steps, follow these steps. There are guides to accompany many of the workflow templates for building and testing projects. For more information, see [AUTOTITLE](/actions/automating-builds-and-tests). 1. Some workflow templates use secrets. For example, {% raw %}`${{ secrets.npm\_token }}`{% endraw %}. If the workflow template uses a secret, store the value described in the secret name as a secret in your repository. For more information, see [AUTOTITLE](/actions/security-guides/using-secrets-in-github-actions). 1. Optionally, make additional changes. For example, you might want to change the value of `on` when the workflow runs. 1. Click \*\*Start commit\*\*. 1. Write a commit message and decide whether to commit directly to the default branch or to open a pull request. ## Further reading \* [AUTOTITLE](/actions/automating-builds-and-tests/about-continuous-integration) \* [AUTOTITLE](/actions/managing-workflow-runs) \* [AUTOTITLE](/actions/monitoring-and-troubleshooting-workflows/about-monitoring-and-troubleshooting) {% ifversion fpt or ghec %} \* [AUTOTITLE](/billing/managing-billing-for-github-actions) {% endif %} | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/use-workflow-templates.md | main | github-actions | [
-0.020552033558487892,
-0.021870840340852737,
-0.029074423015117645,
0.028651058673858643,
0.04221039265394211,
0.03025650419294834,
-0.015478529967367649,
-0.015268787741661072,
-0.029375379905104637,
-0.018535058945417404,
-0.06038261577486992,
-0.004699645563960075,
-0.011750413104891777,... | 0.063126 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## Prerequisites To learn more about workflows and triggering workflows, see [AUTOTITLE](/actions/concepts/workflows-and-actions/workflows). ## Triggering a workflow from a workflow {% data reusables.actions.actions-do-not-trigger-workflows %} For more information, see [AUTOTITLE](/actions/security-guides/automatic-token-authentication). If you do want to trigger a workflow from within a workflow run, you can use a {% data variables.product.prodname\_github\_app %} installation access token or a {% data variables.product.pat\_generic %} instead of `GITHUB\_TOKEN` to trigger events that require a token. If you use a {% data variables.product.prodname\_github\_app %}, you'll need to create a {% data variables.product.prodname\_github\_app %} and store the app ID and private key as secrets. For more information, see [AUTOTITLE](/apps/creating-github-apps/guides/making-authenticated-api-requests-with-a-github-app-in-a-github-actions-workflow). If you use a {% data variables.product.pat\_generic %}, you'll need to create a {% data variables.product.pat\_generic %} and store it as a secret. For more information about creating a {% data variables.product.pat\_generic %}, see [AUTOTITLE](/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token). For more information about storing secrets, see [AUTOTITLE](/actions/security-guides/using-secrets-in-github-actions). To minimize your {% data variables.product.prodname\_actions %} usage costs, ensure that you don't create recursive or unintended workflow runs. For example, the following workflow uses a {% data variables.product.pat\_generic %} (stored as a secret called `MY\_TOKEN`) to add a label to an issue via {% data variables.product.prodname\_cli %}. Any workflows that run when a label is added will run once this step is performed. ```yaml on: issues: types: - opened jobs: label\_issue: runs-on: ubuntu-latest steps: - env: GH\_TOKEN: {% raw %}${{ secrets.MY\_TOKEN }}{% endraw %} ISSUE\_URL: {% raw %}${{ github.event.issue.html\_url }}{% endraw %} run: | gh issue edit $ISSUE\_URL --add-label "triage" ``` Conversely, the following workflow uses `GITHUB\_TOKEN` to add a label to an issue. It will not trigger any workflows that run when a label is added. ```yaml on: issues: types: - opened jobs: label\_issue: runs-on: ubuntu-latest steps: - env: GH\_TOKEN: {% raw %}${{ secrets.GITHUB\_TOKEN }}{% endraw %} ISSUE\_URL: {% raw %}${{ github.event.issue.html\_url }}{% endraw %} run: | gh issue edit $ISSUE\_URL --add-label "triage" ``` ## Using events to trigger workflows Use the `on` key to specify what events trigger your workflow. For more information about events you can use, see [AUTOTITLE](/actions/using-workflows/events-that-trigger-workflows). ### Using a single event {% data reusables.actions.on-single-example %} ### Using multiple events {% data reusables.actions.on-multiple-example %} ### Using activity types and filters with multiple events You can use activity types and filters to further control when your workflow will run. For more information, see [Using event activity types](#using-event-activity-types) and [Using filters](#using-filters). {% data reusables.actions.actions-multiple-types %} ## Using event activity types {% data reusables.actions.actions-activity-types %} ## Using filters {% data reusables.actions.actions-filters %} ### Using filters to target specific branches for pull request events {% data reusables.actions.workflows.triggering-workflow-branches1 %} #### Example: Including branches {% data reusables.actions.workflows.triggering-workflow-branches2 %} #### Example: Excluding branches {% data reusables.actions.workflows.triggering-workflow-branches3 %} #### Example: Including and excluding branches {% data reusables.actions.workflows.triggering-workflow-branches4 %} ### Using filters to target specific branches or tags for push events {% data reusables.actions.workflows.run-on-specific-branches-or-tags1 %} #### Example: Including branches and tags {% data reusables.actions.workflows.run-on-specific-branches-or-tags2 %} #### Example: Excluding branches and tags {% data reusables.actions.workflows.run-on-specific-branches-or-tags3 %} #### Example: Including and excluding branches and tags {% data reusables.actions.workflows.run-on-specific-branches-or-tags4 %} ### Using filters to target specific paths for pull request or push events {% data reusables.actions.workflows.triggering-a-workflow-paths1 %} #### Example: Including paths {% data reusables.actions.workflows.triggering-a-workflow-paths2 %} #### Example: Excluding paths {% data reusables.actions.workflows.triggering-a-workflow-paths3 %} #### Example: Including and excluding paths {% data reusables.actions.workflows.triggering-a-workflow-paths4 %} #### Git diff comparisons {% data reusables.actions.workflows.triggering-a-workflow-paths5 %} ### Using filters to target specific branches for workflow run events {% data reusables.actions.workflows.section-specifying-branches %} ## Defining inputs for manually triggered workflows {% data reusables.actions.workflow-dispatch %} {% data reusables.actions.workflow-dispatch-inputs %} {% data reusables.actions.workflow-dispatch-inputs-example %} ## Defining inputs, outputs, and secrets for reusable workflows You can define inputs and | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-when-workflows-run/trigger-a-workflow.md | main | github-actions | [
-0.02003607712686062,
-0.056957751512527466,
-0.061388321220874786,
0.0007281809812411666,
-0.0117176603525877,
0.03812370449304581,
0.06295929849147797,
0.09745005518198013,
-0.005517561919987202,
-0.03177814930677414,
-0.02498098462820053,
-0.005186222959309816,
0.03110116720199585,
-0.0... | 0.090385 |
reusables.actions.workflows.triggering-a-workflow-paths5 %} ### Using filters to target specific branches for workflow run events {% data reusables.actions.workflows.section-specifying-branches %} ## Defining inputs for manually triggered workflows {% data reusables.actions.workflow-dispatch %} {% data reusables.actions.workflow-dispatch-inputs %} {% data reusables.actions.workflow-dispatch-inputs-example %} ## Defining inputs, outputs, and secrets for reusable workflows You can define inputs and secrets that a reusable workflow should receive from a calling workflow. You can also specify outputs that a reusable workflow will make available to a calling workflow. For more information, see [AUTOTITLE](/actions/using-workflows/reusing-workflows). ## Using event information Information about the event that triggered a workflow run is available in the `github.event` context. The properties in the `github.event` context depend on the type of event that triggered the workflow. For example, a workflow triggered when an issue is labeled would have information about the issue and label. ### Viewing all properties of an event Reference the webhook event documentation for common properties and example payloads. For more information, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads). You can also print the entire `github.event` context to see what properties are available for the event that triggered your workflow: ```yaml jobs: print\_context: runs-on: ubuntu-latest steps: - env: EVENT\_CONTEXT: {% raw %}${{ toJSON(github.event) }}{% endraw %} run: | echo $EVENT\_CONTEXT ``` ### Accessing and using event properties You can use the `github.event` context in your workflow. For example, the following workflow runs when a pull request that changes `package\*.json`, `.github/CODEOWNERS`, or `.github/workflows/\*\*` is opened. If the pull request author (`github.event.pull\_request.user.login`) is not `octobot` or `dependabot[bot]`, then the workflow uses the {% data variables.product.prodname\_cli %} to label and comment on the pull request (`github.event.pull\_request.number`). ```yaml on: pull\_request: types: - opened paths: - '.github/workflows/\*\*' - '.github/CODEOWNERS' - 'package\*.json' jobs: triage: if: >- github.event.pull\_request.user.login != 'octobot' && github.event.pull\_request.user.login != 'dependabot[bot]' runs-on: ubuntu-latest steps: - name: "Comment about changes we can't accept" env: GH\_TOKEN: {% raw %}${{ secrets.GITHUB\_TOKEN }}{% endraw %} PR: {% raw %}${{ github.event.pull\_request.html\_url }}{% endraw %} run: | gh pr edit $PR --add-label 'invalid' gh pr comment $PR --body 'It looks like you edited `package\*.json`, `.github/CODEOWNERS`, or `.github/workflows/\*\*`. We do not allow contributions to these files. Please review our [contributing guidelines](https://github.com/octo-org/octo-repo/blob/main/CONTRIBUTING.md) for what contributions are accepted.' ``` For more information about contexts, see [AUTOTITLE](/actions/learn-github-actions/contexts). For more information about event payloads, see [AUTOTITLE](/webhooks-and-events/webhooks/webhook-events-and-payloads). ## Further controlling how your workflow will run If you want more granular control than events, event activity types, or event filters provide, you can use conditionals and environments to control whether individual jobs or steps in your workflow will run. ### Using conditionals You can use conditionals to further control whether jobs or steps in your workflow will run. #### Example using a value in the event payload For example, if you want the workflow to run when a specific label is added to an issue, you can trigger on the `issues labeled` event activity type and use a conditional to check what label triggered the workflow. The following workflow will run when any label is added to an issue in the workflow's repository, but the `run\_if\_label\_matches` job will only execute if the label is named `bug`. ```yaml on: issues: types: - labeled jobs: run\_if\_label\_matches: if: github.event.label.name == 'bug' runs-on: ubuntu-latest steps: - run: echo 'The label was bug' ``` #### Example using event type For example, if you want to run different jobs or steps depending on what event triggered the workflow, you can use a conditional to check whether a specific event type exists in the event context. The following workflow will run whenever an issue or pull request is closed. If the workflow ran because an issue was closed, the `github.event` context will contain a value | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-when-workflows-run/trigger-a-workflow.md | main | github-actions | [
-0.03951246663928032,
-0.0737018808722496,
-0.027665643021464348,
0.06561003625392914,
-0.010384147986769676,
0.0030239569023251534,
0.049801237881183624,
-0.010517514310777187,
0.003962064627557993,
-0.07000917196273804,
-0.0487031452357769,
0.05046232044696808,
0.033361636102199554,
-0.0... | 0.110608 |
event triggered the workflow, you can use a conditional to check whether a specific event type exists in the event context. The following workflow will run whenever an issue or pull request is closed. If the workflow ran because an issue was closed, the `github.event` context will contain a value for `issue` but not for `pull\_request`. Therefore, the `if\_issue` step will run but the `if\_pr` step will not run. Conversely, if the workflow ran because a pull request was closed, the `if\_pr` step will run but the `if\_issue` step will not run. ```yaml on: issues: types: - closed pull\_request: types: - closed jobs: state\_event\_type: runs-on: ubuntu-latest steps: - name: if\_issue if: github.event.issue run: | echo An issue was closed - name: if\_pr if: github.event.pull\_request run: | echo A pull request was closed ``` For more information about what information is available in the event context, see [Using event information](#using-event-information). For more information about how to use conditionals, see [AUTOTITLE](/actions/learn-github-actions/expressions). ### Using environments to manually trigger workflow jobs If you want to manually trigger a specific job in a workflow, you can use an environment that requires approval from a specific team or user. First, configure an environment with required reviewers. For more information, see [AUTOTITLE](/actions/deployment/targeting-different-environments/managing-environments-for-deployment). Then, reference the environment name in a job in your workflow using the `environment:` key. Any job referencing the environment will not run until at least one reviewer approves the job. For example, the following workflow will run whenever there is a push to main. The `build` job will always run. The `publish` job will only run after the `build` job successfully completes (due to `needs: [build]`) and after all of the rules (including required reviewers) for the environment called `production` pass (due to `environment: production`). ```yaml on: push: branches: - main jobs: build: runs-on: ubuntu-latest steps: - name: build run: | echo 'building' publish: needs: [build] runs-on: ubuntu-latest environment: production steps: - name: publish run: | echo 'publishing' ``` > [!NOTE] > {% data reusables.gated-features.environments %} ## Available events For a full list of available events, see [AUTOTITLE](/actions/using-workflows/events-that-trigger-workflows). | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-when-workflows-run/trigger-a-workflow.md | main | github-actions | [
-0.006138939410448074,
-0.038355305790901184,
-0.018128912895917892,
0.013802614063024521,
0.07347790896892548,
-0.03622562810778618,
0.03563186526298523,
-0.0209620650857687,
0.089106485247612,
-0.011006233282387257,
-0.02145671285688877,
-0.02539016492664814,
-0.043696772307157516,
-0.04... | 0.07641 |
You can use the `jobs..if` conditional to prevent a job from running unless a condition is met. {% data reusables.actions.if-supported-contexts %} ### Example: Only run job for a specific repository This example uses `if` to control when the `production-deploy` job can run. It will only run if the repository is named `octo-repo-prod` and is within the `octo-org` organization. Otherwise, the job will be marked as \_skipped\_. ```yaml copy name: example-workflow on: [push] jobs: production-deploy: if: {% raw %}${{ github.repository == 'octo-org/octo-repo-prod' }}{% endraw %} runs-on: ubuntu-latest steps: - uses: {% data reusables.actions.action-checkout %} - uses: {% data reusables.actions.action-setup-node %} with: node-version: '14' - run: npm install -g bats ``` Skipped jobs display the message "This check was skipped." > [!NOTE] > A job that is skipped will report its status as "Success". It will not prevent a pull request from merging, even if it is a required check. {% ifversion fpt or ghec %} To debug why a job was skipped or ran unexpectedly, you can view job condition expression logs. For more information, see [AUTOTITLE](/actions/how-tos/monitor-workflows/view-job-condition-logs). {% endif %} | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-when-workflows-run/control-jobs-with-conditions.md | main | github-actions | [
-0.030777890235185623,
-0.008547589182853699,
-0.009223828092217445,
0.01098854374140501,
0.03620321676135063,
-0.05999378114938736,
-0.004978707525879145,
-0.11377919465303421,
0.023324787616729736,
0.0030184772331267595,
0.05656726658344269,
-0.024655688554048538,
-0.01954963430762291,
-... | 0.017807 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## Overview {% data reusables.actions.jobs.section-running-jobs-in-a-container %} ### Dockerfile instructions and overrides A Dockerfile contains instructions and arguments that define the contents and startup behavior of a Docker container. For more information about the instructions Docker supports, see [Dockerfile reference](https://docs.docker.com/engine/reference/builder/) in the Docker documentation. Some Docker instructions interact with {% data variables.product.prodname\_actions %}, and an action's metadata file can override some Docker instructions. Ensure that you are familiar with how your Dockerfile interacts with {% data variables.product.prodname\_actions %} to prevent any unexpected behavior. For reference information, see [AUTOTITLE](/actions/reference/dockerfile-support-for-github-actions). ## Defining the container image {% data reusables.actions.jobs.section-running-jobs-in-a-container-image %} ## Defining credentials for a container registry {% data reusables.actions.jobs.section-running-jobs-in-a-container-credentials %} ## Using environment variables with a container {% data reusables.actions.jobs.section-running-jobs-in-a-container-env %} ## Exposing network ports on a container {% data reusables.actions.jobs.section-running-jobs-in-a-container-ports %} ## Mounting volumes in a container {% data reusables.actions.jobs.section-running-jobs-in-a-container-volumes %} ## Setting container resource options {% data reusables.actions.jobs.section-running-jobs-in-a-container-options %} | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-where-workflows-run/run-jobs-in-a-container.md | main | github-actions | [
-0.014804964885115623,
0.0004237220564391464,
-0.013331534340977669,
0.03430403396487236,
0.028099752962589264,
-0.009333958849310875,
0.00513785844668746,
0.02736329287290573,
-0.049932628870010376,
0.029155999422073364,
-0.02603011392056942,
0.0725712925195694,
0.010112901218235493,
-0.0... | 0.046439 |
## Defining and using job outputs 1. Open the workflow file containing the job you want to get outputs from. 1. Use the `jobs..outputs` syntax to define the outputs for the job. For example, the following job defines the `output1` and `output2` outputs, which are mapped to the results of `step1` and `step2` respectively: ```yaml jobs: job1: runs-on: ubuntu-latest outputs: output1: {% raw %}${{ steps.step1.outputs.test }}{% endraw %} output2: {% raw %}${{ steps.step2.outputs.test }}{% endraw %} steps: - id: step1 run: echo "test=hello" >> "$GITHUB\_OUTPUT" - id: step2 run: echo "test=world" >> "$GITHUB\_OUTPUT" ``` 1. In a separate job where you want to access those outputs, use the `jobs..needs` syntax to make it dependent on the original job. For example, the following job checks that `job1` is complete before running: ```yaml jobs: # Assume job1 is defined as above job2: runs-on: ubuntu-latest needs: job1 ``` 1. To access the outputs in the dependent job, use the `needs..outputs.` syntax. For example, the following job accesses the `output1` and `output2` outputs defined in `job1`: ```yaml jobs: # Assume job1 is defined as above job2: runs-on: ubuntu-latest needs: job1 steps: - env: OUTPUT1: {% raw %}${{needs.job1.outputs.output1}}{% endraw %} OUTPUT2: {% raw %}${{needs.job1.outputs.output2}}{% endraw %} run: echo "$OUTPUT1 $OUTPUT2" ``` ## Next steps To learn more about job outputs and the `needs` context, see the following sections of [AUTOTITLE](/actions/reference/workflow-syntax-for-github-actions#jobsjob\_idoutputs): \* [`jobs..outputs`](/actions/reference/workflow-syntax-for-github-actions#jobsjob\_idoutputs) \* [`jobs..needs`](/actions/reference/workflow-syntax-for-github-actions#jobsjob\_idneeds) | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-what-workflows-do/pass-job-outputs.md | main | github-actions | [
-0.04437791556119919,
-0.001568255596794188,
-0.043397776782512665,
0.04639950394630432,
0.004934704862535,
-0.0018830661429092288,
-0.0402178019285202,
0.005205037072300911,
-0.023024164140224457,
-0.078523188829422,
-0.03417292982339859,
0.011781695298850536,
0.0038005553651601076,
-0.04... | 0.011744 |
{% data reusables.actions.enterprise-marketplace-actions %} {% data reusables.actions.actions-marketplace-ghecom %} {% ifversion fpt or ghec %} ## Browsing Marketplace actions in the workflow editor You can search and browse actions directly in your repository's workflow editor. From the sidebar, you can search for a specific action, view featured actions, and browse featured categories. You can also view the number of stars an action has received from the {% data variables.product.prodname\_dotcom %} community. 1. In your repository, browse to the workflow file you want to edit. 1. In the upper right corner of the file view, to open the workflow editor, click {% octicon "pencil" aria-label="Edit file" %}.  1. To the right of the editor, use the {% data variables.product.prodname\_marketplace %} sidebar to browse actions. Actions with the {% octicon "verified" aria-label="Creator verified by GitHub" %} badge indicate {% data variables.product.prodname\_dotcom %} has verified the creator of the action as a partner organization.  ## Adding an action to your workflow You can add an action to your workflow by referencing the action in your workflow file. The actions you use in your workflow can be defined in: \* The same repository as your workflow file{% ifversion ghec or ghes %} \* An internal repository within the same enterprise account that is configured to allow access to workflows{% endif %} \* Any public repository \* A published Docker container image on Docker Hub You can view the actions referenced in your {% data variables.product.prodname\_actions %} workflows as dependencies in the dependency graph of the repository containing your workflows. For more information, see “[About the dependency graph](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph).” {% data reusables.actions.actions-redirects-workflows %} ### Adding an action from {% data variables.product.prodname\_marketplace %} An action's listing page includes the action's version and the workflow syntax required to use the action. To keep your workflow stable even when updates are made to an action, you can reference the version of the action to use by specifying the Git or Docker tag number in your workflow file. 1. Navigate to the action you want to use in your workflow. 1. Click to view the full marketplace listing for the action. 1. Under "Installation", click {% octicon "copy" aria-label="Copy to clipboard" %} to copy the workflow syntax.  1. Paste the syntax as a new step in your workflow. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idsteps). 1. If the action requires you to provide inputs, set them in your workflow. For information on inputs an action might require, see [AUTOTITLE](/actions/learn-github-actions/finding-and-customizing-actions#using-inputs-and-outputs-with-an-action). {% data reusables.dependabot.version-updates-for-actions %} {% endif %} ### Adding an action from the same repository If an action is defined in the same repository where your workflow file uses the action, you can reference the action with either the `{owner}/{repo}@{ref}` or `./path/to/dir` syntax in your workflow file. {% data reusables.actions.workflows.section-referencing-an-action-from-the-same-repository %} The `action.yml` file is used to provide metadata for the action. Learn about the content of this file in [AUTOTITLE](/actions/creating-actions/metadata-syntax-for-github-actions). ### Adding an action from a different repository If an action is defined in a different repository than your workflow file, you can reference the action with the `{owner}/{repo}@{ref}` syntax in your workflow file. The action must be stored in a public repository{% ifversion ghec or ghes %} or an internal repository that is configured | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-what-workflows-do/find-and-customize-actions.md | main | github-actions | [
0.000744034128729254,
-0.03967302665114403,
-0.10471554100513458,
0.0402410551905632,
0.003336970927193761,
0.09176075458526611,
0.0591544508934021,
-0.0001795150019461289,
-0.0414578840136528,
0.04044346511363983,
-0.003684258321300149,
0.022170452401041985,
-0.03962000086903572,
-0.05845... | 0.078309 |
a different repository If an action is defined in a different repository than your workflow file, you can reference the action with the `{owner}/{repo}@{ref}` syntax in your workflow file. The action must be stored in a public repository{% ifversion ghec or ghes %} or an internal repository that is configured to allow access to workflows. For more information, see [AUTOTITLE](/actions/creating-actions/sharing-actions-and-workflows-with-your-enterprise).{% else %}.{% endif %} ```yaml jobs: my\_first\_job: steps: - name: My first step uses: {% data reusables.actions.action-setup-node %} ``` {% ifversion ghec or ghes %} If {% ifversion ghec %}you're on {% data variables.enterprise.data\_residency\_site %}{% elsif ghes %}an enterprise owner has enabled access to actions on {% data variables.product.prodname\_dotcom\_the\_website %}{% endif %}, you can use this syntax to reference actions either within your enterprise or on {% data variables.product.prodname\_dotcom\_the\_website %}. {% data variables.product.prodname\_actions %} will look for the action in your enterprise first, then fall back to {% data variables.product.prodname\_dotcom\_the\_website %}. {% endif %} ### Referencing a container on Docker Hub If an action is defined in a published Docker container image on Docker Hub, you must reference the action with the `docker://{image}:{tag}` syntax in your workflow file. To protect your code and data, we strongly recommend you verify the integrity of the Docker container image from Docker Hub before using it in your workflow. ```yaml jobs: my\_first\_job: steps: - name: My first step uses: docker://alpine:3.8 ``` For some examples of Docker actions, see the [Docker-image.yml workflow](https://github.com/actions/starter-workflows/blob/main/ci/docker-image.yml) and [AUTOTITLE](/actions/creating-actions/creating-a-docker-container-action). ### Security hardening for using actions in your workflows {% data reusables.actions.about-security-hardening-for-worklows %} ## Using release management for your custom actions The creators of a community action have the option to use tags, branches, or SHA values to manage releases of the action. Similar to any dependency, you should indicate the version of the action you'd like to use based on your comfort with automatically accepting updates to the action. You will designate the version of the action in your workflow file. Check the action's documentation for information on their approach to release management, and to see which tag, branch, or SHA value to use. > [!NOTE] > We recommend that you use a SHA value when using third-party actions. However, it's important to note {% data variables.product.prodname\_dependabot %} will only create {% data variables.product.prodname\_dependabot\_alerts %} for vulnerable {% data variables.product.prodname\_actions %} that use semantic versioning. For more information, see [AUTOTITLE](/actions/security-guides/security-hardening-for-github-actions#using-third-party-actions) and [AUTOTITLE](/code-security/dependabot/dependabot-alerts/about-dependabot-alerts). ### Using tags Tags are useful for letting you decide when to switch between major and minor versions, but these are more ephemeral and can be moved or deleted by the maintainer. This example demonstrates how to target an action that's been tagged as `v1.0.1`: ```yaml steps: - uses: actions/javascript-action@v1.0.1 ``` ### Using SHAs If you need more reliable versioning, you should use the SHA value associated with the version of the action. SHAs are immutable and therefore more reliable than tags or branches. However, this approach means you will not automatically receive updates for an action, including important bug fixes and security updates. You must use a commit's full SHA value, and not an abbreviated value. {% data reusables.actions.actions-pin-commit-sha %} This example targets an action's SHA: ```yaml steps: - uses: actions/javascript-action@a824008085750b8e136effc585c3cd6082bd575f ``` ### Using branches Specifying a target branch for the action means it will always run the version currently on that branch. This approach can create problems if an update to the branch includes breaking changes. This example targets a branch named `@main`: ```yaml steps: - uses: actions/javascript-action@main ``` For more information, see [AUTOTITLE](/actions/creating-actions/about-custom-actions#using-release-management-for-actions). ## Using inputs and outputs with an action An action often accepts or requires inputs and generates outputs that you can use. | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-what-workflows-do/find-and-customize-actions.md | main | github-actions | [
-0.07178939133882523,
-0.056020818650722504,
-0.032038044184446335,
-0.02725192718207836,
-0.02241097390651703,
0.0012822390999644995,
0.07555079460144043,
-0.014763858169317245,
-0.009568012319505215,
0.013528981246054173,
-0.006690333131700754,
-0.026199432089924812,
-0.025441620498895645,... | 0.05615 |
problems if an update to the branch includes breaking changes. This example targets a branch named `@main`: ```yaml steps: - uses: actions/javascript-action@main ``` For more information, see [AUTOTITLE](/actions/creating-actions/about-custom-actions#using-release-management-for-actions). ## Using inputs and outputs with an action An action often accepts or requires inputs and generates outputs that you can use. For example, an action might require you to specify a path to a file, the name of a label, or other data it will use as part of the action processing. To see the inputs and outputs of an action, check the `action.yml` in the root directory of the repository. In this example `action.yml`, the `inputs` keyword defines a required input called `file-path`, and includes a default value that will be used if none is specified. The `outputs` keyword defines an output called `results-file`, which tells you where to locate the results. ```yaml name: "Example" description: "Receives file and generates output" inputs: file-path: # id of input description: "Path to test script" required: true default: "test-file.js" outputs: results-file: # id of output description: "Path to results file" ``` | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-what-workflows-do/find-and-customize-actions.md | main | github-actions | [
-0.023852534592151642,
-0.09855400025844574,
0.0038290780503302813,
0.010526977479457855,
0.022013239562511444,
-0.028723131865262985,
-0.018255652859807014,
0.0017791648861020803,
0.06349001824855804,
0.09035348892211914,
0.053976140916347504,
0.058517202734947205,
-0.04777344688773155,
-... | 0.079394 |
## Prerequisites You need to create an environment before you can use it in a workflow. See [AUTOTITLE](/actions/how-tos/managing-workflow-runs-and-deployments/managing-deployments/managing-environments-for-deployment#creating-an-environment). ## Using an environment in a workflow 1. Open the workflow file you want to edit. 1. Use the following syntax to add a [`jobs..environment`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idenvironment) key to your workflow: ```yaml copy jobs: JOB-ID: environment: ENVIRONMENT-NAME ``` The chosen job will now be subject to any rules configured for the specified environment. 1. Optionally, specify a deployment URL for the environment using the following syntax: ```yaml copy jobs: JOB-ID: environment: name: ENVIRONMENT-NAME url: URL ``` The specified URL will appear: \* On the deployments page for the repository \* In the visualization graph for the workflow run \* (If a pull request triggers the workflow) As a "View deployment" button in the pull request timeline | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-what-workflows-do/deploy-to-environment.md | main | github-actions | [
-0.015807390213012695,
-0.0741252601146698,
0.0038113172631710768,
-0.021243037655949593,
-0.025981660932302475,
-0.03425822779536247,
-0.003783941501751542,
-0.05635305121541023,
-0.029731888324022293,
-0.0005332477740012109,
-0.09858578443527222,
-0.11217881739139557,
0.04017637297511101,
... | 0.067921 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## Overview {% data reusables.actions.jobs.setting-default-values-for-jobs-defaults %} ## Setting default shell and working directory {% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-run %} ## Setting default values for a specific job {% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-job %} ## Setting default shell and working directory for a job {% data reusables.actions.jobs.setting-default-values-for-jobs-defaults-job-run %} ### Example: Setting default `run` step options for a job {% data reusables.actions.jobs.setting-default-run-value-for-job-example %} | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-what-workflows-do/set-default-values-for-jobs.md | main | github-actions | [
-0.02549828216433525,
-0.02485698089003563,
-0.0337093360722065,
0.09722061455249786,
-0.03882870078086853,
0.015110797248780727,
-0.02790866605937481,
-0.004070030990988016,
-0.06642170250415802,
0.01568029448390007,
0.008842701092362404,
0.054987043142318726,
0.004799666348844767,
-0.002... | 0.014408 |
{% data reusables.cli.cli-learn-more %} {% data variables.product.prodname\_cli %} is preinstalled on all {% data variables.product.prodname\_dotcom %}-hosted runners. For each step that uses {% data variables.product.prodname\_cli %}, you must set an environment variable called `GH\_TOKEN` to a token with the required scopes. You can execute any {% data variables.product.prodname\_cli %} command. For example, this workflow uses the `gh issue comment` subcommand to add a comment when an issue is opened. ```yaml copy name: Comment when opened on: issues: types: - opened jobs: comment: runs-on: ubuntu-latest steps: - run: gh issue comment $ISSUE --body "Thank you for opening this issue!" env: GH\_TOKEN: {% raw %}${{ secrets.GITHUB\_TOKEN }}{% endraw %} ISSUE: {% raw %}${{ github.event.issue.html\_url }}{% endraw %} ``` You can also execute API calls through {% data variables.product.prodname\_cli %}. For example, this workflow first uses the `gh api` subcommand to query the GraphQL API and parse the result. Then it stores the result in an environment variable that it can access in a later step. In the second step, it uses the `gh issue create` subcommand to create an issue containing the information from the first step. ```yaml copy name: Report remaining open issues on: schedule: # Daily at 8:20 UTC - cron: '20 8 \* \* \*' jobs: track\_pr: runs-on: ubuntu-latest steps: - run: | numOpenIssues="$(gh api graphql -F owner=$OWNER -F name=$REPO -f query=' query($name: String!, $owner: String!) { repository(owner: $owner, name: $name) { issues(states:OPEN){ totalCount } } } ' --jq '.data.repository.issues.totalCount')" echo 'NUM\_OPEN\_ISSUES='$numOpenIssues >> $GITHUB\_ENV env: GH\_TOKEN: {% raw %}${{ secrets.GITHUB\_TOKEN }}{% endraw %} OWNER: {% raw %}${{ github.repository\_owner }}{% endraw %} REPO: {% raw %}${{ github.event.repository.name }}{% endraw %} - run: | gh issue create --title "Issue report" --body "$NUM\_OPEN\_ISSUES issues remaining" --repo $GITHUB\_REPOSITORY env: GH\_TOKEN: {% raw %}${{ secrets.GITHUB\_TOKEN }}{% endraw %} ``` | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-what-workflows-do/use-github-cli.md | main | github-actions | [
-0.016906719654798508,
-0.012018311768770218,
-0.007414872292429209,
0.046873122453689575,
0.03188147768378258,
-0.029566017910838127,
0.04174775630235672,
0.0623868927359581,
-0.02406223677098751,
-0.009579828940331936,
-0.01781976781785488,
-0.03487631306052208,
0.017445938661694527,
0.0... | 0.066473 |
## About matrix strategies {% data reusables.actions.jobs.about-matrix-strategy %} ## Adding a matrix strategy to your workflow job Use `jobs..strategy.matrix` to define a matrix of different job configurations. Within your matrix, define one or more variables followed by an array of values. For example, the following matrix has a variable called `version` with the value `[10, 12, 14]` and a variable called `os` with the value `[ubuntu-latest, windows-latest]`: ```yaml jobs: example\_matrix: strategy: matrix: version: [10, 12, 14] os: [ubuntu-latest, windows-latest] ``` A job will run for each possible combination of the variables. In this example, the workflow will run six jobs, one for each combination of the `os` and `version` variables. The above matrix will create the jobs in the following order. \* `{version: 10, os: ubuntu-latest}` \* `{version: 10, os: windows-latest}` \* `{version: 12, os: ubuntu-latest}` \* `{version: 12, os: windows-latest}` \* `{version: 14, os: ubuntu-latest}` \* `{version: 14, os: windows-latest}` For reference information and examples, see [AUTOTITLE](/actions/reference/workflow-syntax-for-github-actions#jobsjob\_idstrategymatrix). ## Using contexts to create matrices To create matrices with information about workflow runs, variables, runner environments, jobs, and steps, access contexts using the {% raw %}`${{ }}`{% endraw %} expression syntax. For more information about contexts, see [AUTOTITLE](/actions/learn-github-actions/contexts). For example, the following workflow triggers on the `repository\_dispatch` event and uses information from the event payload to build the matrix. When a repository dispatch event is created with a payload like the one below, the matrix `version` variable will have a value of `[12, 14, 16]`. For more information about the `repository\_dispatch` trigger, see [AUTOTITLE](/actions/using-workflows/events-that-trigger-workflows#repository\_dispatch). ```json { "event\_type": "test", "client\_payload": { "versions": [12, 14, 16] } } ``` ```yaml on: repository\_dispatch: types: - test jobs: example\_matrix: runs-on: ubuntu-latest strategy: matrix: version: {% raw %}${{ github.event.client\_payload.versions }}{% endraw %} steps: - uses: {% data reusables.actions.action-setup-node %} with: node-version: {% raw %}${{ matrix.version }}{% endraw %} ``` ## Expanding or adding matrix configurations To expand existing matrix configurations or to add new configurations, use `jobs..strategy.matrix.include`. The value of `include` is a list of objects. For example, consider the following matrix. ```yaml strategy: matrix: fruit: [apple, pear] animal: [cat, dog] include: - color: green - color: pink animal: cat - fruit: apple shape: circle - fruit: banana - fruit: banana animal: cat ``` This will result in six jobs with the following matrix combinations. \* `{fruit: apple, animal: cat, color: pink, shape: circle}` \* `{fruit: apple, animal: dog, color: green, shape: circle}` \* `{fruit: pear, animal: cat, color: pink}` \* `{fruit: pear, animal: dog, color: green}` \* `{fruit: banana}` \* `{fruit: banana, animal: cat}` Each `include` entry was applied in the following ways. \* `{color: green}` is added to all of the original matrix combinations because it can be added without overwriting any part of the original combinations. \* `{color: pink, animal: cat}` adds `color:pink` only to the original matrix combinations that include `animal: cat`. This overwrites the `color: green` that was added by the previous `include` entry. \* `{fruit: apple, shape: circle}` adds `shape: circle` only to the original matrix combinations that include `fruit: apple`. \* `{fruit: banana}` cannot be added to any original matrix combination without overwriting a value, so it is added as an additional matrix combination. \* `{fruit: banana, animal: cat}` cannot be added to any original matrix combination without overwriting a value, so it is added as an additional matrix combination. It does not add to the `{fruit: banana}` matrix combination because that combination was not one of the original matrix combinations. For reference and example configurations, see [AUTOTITLE](/actions/reference/workflow-syntax-for-github-actions#jobsjob\_idstrategymatrixinclude). ## Excluding matrix configurations To remove specific configurations defined in the matrix, use `jobs..strategy.matrix.exclude`. For example, the following workflow will run | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-what-workflows-do/run-job-variations.md | main | github-actions | [
-0.004662134684622288,
0.010457640513777733,
-0.09354185312986374,
-0.008649456314742565,
-0.0376795195043087,
0.009136549197137356,
-0.032833512872457504,
-0.08443993330001831,
-0.044732023030519485,
-0.00405157171189785,
-0.018493322655558586,
0.04368599131703377,
-0.0034347274340689182,
... | 0.033357 |
combination. It does not add to the `{fruit: banana}` matrix combination because that combination was not one of the original matrix combinations. For reference and example configurations, see [AUTOTITLE](/actions/reference/workflow-syntax-for-github-actions#jobsjob\_idstrategymatrixinclude). ## Excluding matrix configurations To remove specific configurations defined in the matrix, use `jobs..strategy.matrix.exclude`. For example, the following workflow will run nine jobs: one job for each of the 12 configurations, minus the one excluded job that matches `{os: macos-latest, version: 12, environment: production}`, and the two excluded jobs that match `{os: windows-latest, version: 16}`. ```yaml strategy: matrix: os: [macos-latest, windows-latest] version: [12, 14, 16] environment: [staging, production] exclude: - os: macos-latest version: 12 environment: production - os: windows-latest version: 16 runs-on: {% raw %}${{ matrix.os }}{% endraw %} ``` For reference information, see [AUTOTITLE](/actions/reference/workflow-syntax-for-github-actions#jobsjob\_idstrategymatrixexclude) ## Using an output to define two matrices You can use the output from one job to define matrices for multiple jobs. For example, the following workflow demonstrates how to define a matrix of values in one job, use that matrix in a second jobs to produce artifacts, and then consume those artifacts in a third job. Each artifact is associated with a value from the matrix. ```yaml copy name: shared matrix on: push: workflow\_dispatch: jobs: define-matrix: runs-on: ubuntu-latest outputs: colors: {% raw %}${{ steps.colors.outputs.colors }}{% endraw %} steps: - name: Define Colors id: colors run: | echo 'colors=["red", "green", "blue"]' >> "$GITHUB\_OUTPUT" produce-artifacts: runs-on: ubuntu-latest needs: define-matrix strategy: matrix: color: {% raw %}${{ fromJSON(needs.define-matrix.outputs.colors) }}{% endraw %} steps: - name: Define Color env: color: {% raw %}${{ matrix.color }}{% endraw %} run: | echo "$color" > color - name: Produce Artifact uses: {% data reusables.actions.action-upload-artifact %} with: name: {% raw %}${{ matrix.color }}{% endraw %} path: color consume-artifacts: runs-on: ubuntu-latest needs: - define-matrix - produce-artifacts strategy: matrix: color: {% raw %}${{ fromJSON(needs.define-matrix.outputs.colors) }}{% endraw %} steps: - name: Retrieve Artifact uses: {% data reusables.actions.action-download-artifact %} with: name: {% raw %}${{ matrix.color }}{% endraw %} - name: Report Color run: | cat color ``` ## Handling failures To control how job failures are handled, use `jobs..strategy.fail-fast` and `jobs..continue-on-error`. You can use `jobs..strategy.fail-fast` and `jobs..continue-on-error` together. For example, the following workflow will start four jobs. For each job, `continue-on-error` is determined by the value of `matrix.experimental`. If any of the jobs with `continue-on-error: false` fail, all jobs that are in progress or queued will be cancelled. If the job with `continue-on-error: true` fails, the other jobs will not be affected. ```yaml jobs: test: runs-on: ubuntu-latest continue-on-error: {% raw %}${{ matrix.experimental }}{% endraw %} strategy: fail-fast: true matrix: version: [6, 7, 8] experimental: [false] include: - version: 9 experimental: true ``` For reference information see [`jobs..strategy.fail-fast`](/actions/reference/workflow-syntax-for-github-actions#jobsjob\_idstrategyfail-fast) and [`jobs..continue-on-error`](/actions/reference/workflow-syntax-for-github-actions#jobsjob\_idcontinue-on-error). ## Defining the maximum number of concurrent jobs To set the maximum number of jobs that can run simultaneously when using a `matrix` job strategy, use `jobs..strategy.max-parallel`. For example, the following workflow will run a maximum of two jobs at a time, even if there are runners available to run all six jobs at once. ```yaml jobs: example\_matrix: strategy: max-parallel: 2 matrix: version: [10, 12, 14] os: [ubuntu-latest, windows-latest] ``` For reference information, see [AUTOTITLE](/actions/reference/workflow-syntax-for-github-actions#jobsjob\_idstrategymax-parallel). | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-what-workflows-do/run-job-variations.md | main | github-actions | [
-0.015021986328065395,
0.04774980992078781,
-0.06977833807468414,
-0.001966935582458973,
0.05854867771267891,
0.018636947497725487,
-0.011611685156822205,
-0.1242394745349884,
0.020804377272725105,
0.008055445738136768,
0.06536491215229034,
0.012914231047034264,
0.00513639859855175,
-0.039... | 0.067022 |
## Defining environment variables for a single workflow To set a custom environment variable for a single workflow, you can define it using the `env` key in the workflow file. The scope of a custom variable set by this method is limited to the element in which it is defined. You can define variables that are scoped for: \* The entire workflow, by using [`env`](/actions/using-workflows/workflow-syntax-for-github-actions#env) at the top level of the workflow file. \* The contents of a job within a workflow, by using [`jobs..env`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idenv). \* A specific step within a job, by using [`jobs..steps[\*].env`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idstepsenv). {% raw %} ```yaml copy name: Greeting on variable day on: workflow\_dispatch env: DAY\_OF\_WEEK: Monday jobs: greeting\_job: runs-on: ubuntu-latest env: Greeting: Hello steps: - name: "Say Hello Mona it's Monday" run: echo "$Greeting $First\_Name. Today is $DAY\_OF\_WEEK!" env: First\_Name: Mona ``` {% endraw %} You can access `env` variable values using runner environment variables or using contexts. The example above shows three custom variables being used as runner environment variables in an `echo` command: `$DAY\_OF\_WEEK`, `$Greeting`, and `$First\_Name`. The values for these variables are set, and scoped, at the workflow, job, and step level respectively. The interpolation of these variables happens on the runner. The commands in the `run` steps of a workflow, or a referenced action, are processed by the shell you are using on the runner. The instructions in the other parts of a workflow are processed by {% data variables.product.prodname\_actions %} and are not sent to the runner. You can use either runner environment variables or contexts in `run` steps, but in the parts of a workflow that are not sent to the runner you must use contexts to access variable values. For more information, see [Using contexts to access variable values](#using-contexts-to-access-variable-values). Because runner environment variable interpolation is done after a workflow job is sent to a runner machine, you must use the appropriate syntax for the shell that's used on the runner. In this example, the workflow specifies `ubuntu-latest`. By default, Linux runners use the bash shell, so you must use the syntax `$NAME`. By default, Windows runners use PowerShell, so you would use the syntax `$env:NAME`. For more information about shells, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idstepsshell). ## Defining configuration variables for multiple workflows You can create configuration variables for use across multiple workflows, and can define them at either the [organization](#creating-configuration-variables-for-an-organization), [repository](#creating-configuration-variables-for-a-repository), or [environment](#creating-configuration-variables-for-an-environment) level. For example, you can use configuration variables to set default values for parameters passed to build tools at an organization level, but then allow repository owners to override these parameters on a case-by-case basis. When you define configuration variables, they are automatically available in the `vars` context. For more information, see [Using the `vars` context to access configuration variable values](#using-the-vars-context-to-access-configuration-variable-values). ### Creating configuration variables for a repository {% data reusables.actions.permissions-statement-secrets-variables-repository %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.actions.sidebar-secrets-and-variables %} {% data reusables.actions.actions-variables-tab %}  1. Click \*\*New repository variable\*\*. {% data reusables.actions.variable-fields %} 1. Click \*\*Add variable\*\*. ### Creating configuration variables for an environment {% data reusables.actions.permissions-statement-secrets-environment %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.actions.sidebar-environment %} 1. Click on the environment that you want to add a variable to. 1. Under \*\*Environment variables\*\*, click \*\*Add variable\*\*. {% data reusables.actions.variable-fields %} 1. Click \*\*Add variable\*\*. ### Creating configuration variables for an organization {% data reusables.actions.actions-secrets-variables-repository-access %} {% data reusables.actions.permissions-statement-secrets-and-variables-organization %} {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org\_settings %} {% data reusables.actions.sidebar-secrets-and-variables %} {% data reusables.actions.actions-variables-tab %}  {% data reusables.actions.secrets-and-variables-org-permissions %} 1. Click \*\*New organization variable\*\*. {% data reusables.actions.variable-fields %} 1. From the \*\*Repository access\*\* dropdown list, choose an access policy. 1. Click \*\*Add variable\*\*. ## Using contexts to access variable values {% data reusables.actions.actions-contexts-about-description %} For more information, see [AUTOTITLE](/actions/learn-github-actions/contexts). There are many other contexts that you can use for a variety of purposes in your workflows. For details of where you can use specific contexts within a workflow, see [AUTOTITLE](/actions/learn-github-actions/contexts#context-availability). You can access environment variable values using the `env` context and configuration variable values using the `vars` context. ### Using the `env` context to access environment variable values In addition to runner environment variables, {% data variables.product.prodname\_actions %} allows you to set and read `env` key values using contexts. Environment variables and contexts are intended for use at different points in the workflow. The `run` steps in a workflow, or in a referenced action, are processed by a runner. As a result, you can use runner environment variables here, using the appropriate syntax for the shell you are using on the runner - for example, `$NAME` for the bash shell on a Linux runner, or `$env:NAME` for PowerShell on a Windows runner. In most cases you can also use contexts, with the syntax {% raw %}`${{ CONTEXT.PROPERTY }}`{% endraw %}, to access the same value. The difference is that the context will be interpolated and replaced by a string before the job is sent to a runner. However, you cannot use runner environment variables in parts of a workflow that are processed by {% data variables.product.prodname\_actions %} and are not sent to the runner. Instead, you must use contexts. For example, an `if` conditional, which determines whether a job or step is sent to the runner, is always processed by {% data variables.product.prodname\_actions %}. You must therefore use a context in an `if` conditional statement to access the value of an variable. {% raw %} ```yaml copy name: Conditional env variable on: workflow\_dispatch env: DAY\_OF\_WEEK: Monday jobs: greeting\_job: runs-on: ubuntu-latest env: Greeting: Hello steps: - name: "Say Hello Mona it's Monday" if: ${{ env.DAY\_OF\_WEEK == 'Monday' }} run: echo "$Greeting $First\_Name. Today is $DAY\_OF\_WEEK!" env: First\_Name: Mona ``` {% endraw %} In this modification of the earlier example, we've introduced an `if` conditional. The workflow step is now only run if `DAY\_OF\_WEEK` is set to "Monday". We access this value from the `if` conditional statement by using the [`env` context](/actions/learn-github-actions/contexts#env-context). The `env` context is not required for the variables referenced within the `run` command. They are referenced as runner environment variables and are interpolated after the job is received by the runner. We could, however, have chosen to interpolate those variables before sending the job to the runner, by using contexts. The resulting output would be the same. {% raw %} ```yaml run: echo "${{ env.Greeting }} ${{ env.First\_Name }}. Today is ${{ env.DAY\_OF\_WEEK }}!" ``` {% endraw %} > [!NOTE] > Contexts are usually denoted using the dollar sign and curly braces, as {% raw %}`${{ context.property }}`{% endraw %}. In an `if` conditional, the {% raw %}`${{` and `}}`{% endraw %} are optional, but if you use them they must enclose the entire comparison statement, as shown above. {% data reusables.actions.context-injection-warning %} ### Using the `vars` context | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-what-workflows-do/use-variables.md | main | github-actions | [
0.016483033075928688,
-0.02099275216460228,
-0.08437346667051315,
0.1032225713133812,
-0.030214857310056686,
0.02812761254608631,
0.0867525190114975,
-0.05883898213505745,
-0.09464143961668015,
0.04422762989997864,
0.058849167078733444,
0.020709846168756485,
0.03133869171142578,
0.02746276... | -0.024552 |
sign and curly braces, as {% raw %}`${{ context.property }}`{% endraw %}. In an `if` conditional, the {% raw %}`${{` and `}}`{% endraw %} are optional, but if you use them they must enclose the entire comparison statement, as shown above. {% data reusables.actions.context-injection-warning %} ### Using the `vars` context to access configuration variable values Configuration variables can be accessed across the workflow using `vars` context. For more information, see [AUTOTITLE](/actions/learn-github-actions/contexts#vars-context). {% data reusables.actions.actions-vars-context-example-usage %} ## Detecting the operating system You can write a single workflow file that can be used for different operating systems by using the `RUNNER\_OS` default environment variable and the corresponding context property {% raw %}`${{ runner.os }}`{% endraw %}. For example, the following workflow could be run successfully if you changed the operating system from `macos-latest` to `windows-latest` without having to alter the syntax of the environment variables, which differs depending on the shell being used by the runner. {% raw %} ```yaml copy on: workflow\_dispatch jobs: if-Windows-else: runs-on: macos-latest steps: - name: condition 1 if: runner.os == 'Windows' run: echo "The operating system on the runner is $env:RUNNER\_OS." - name: condition 2 if: runner.os != 'Windows' run: echo "The operating system on the runner is not Windows, it's $RUNNER\_OS." ``` {% endraw %} In this example, the two `if` statements check the `os` property of the `runner` context to determine the operating system of the runner. `if` conditionals are processed by {% data variables.product.prodname\_actions %}, and only steps where the check resolves as `true` are sent to the runner. Here one of the checks will always be `true` and the other `false`, so only one of these steps is sent to the runner. Once the job is sent to the runner, the step is executed and the environment variable in the `echo` command is interpolated using the appropriate syntax (`$env:NAME` for PowerShell on Windows, and `$NAME` for bash and sh on Linux and macOS). In this example, the statement `runs-on: macos-latest` means that the second step will be run. ## Passing values between steps and jobs in a workflow If you generate a value in one step of a job, you can use the value in subsequent steps of the same job by assigning the value to an existing or new environment variable and then writing this to the `GITHUB\_ENV` environment file. The environment file can be used directly by an action, or from a shell command in the workflow file by using the `run` keyword. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable). If you want to pass a value from a step in one job in a workflow to a step in another job in the workflow, you can define the value as a job output. You can then reference this job output from a step in another job. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idoutputs). ## Next steps For reference information, see [AUTOTITLE](/actions/reference/variables-reference). | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-what-workflows-do/use-variables.md | main | github-actions | [
0.004614832811057568,
0.019096070900559425,
-0.04577197507023811,
0.04542474076151848,
0.031181057915091515,
-0.019225915893912315,
0.06961765885353088,
0.0642101913690567,
-0.029607661068439484,
-0.03344936668872833,
0.033858299255371094,
-0.009138112887740135,
0.0686635747551918,
-0.0076... | 0.080603 |
You can use a {% data variables.product.prodname\_actions %} workflow to run scripts and shell commands, which are then executed on the assigned runner. This example demonstrates how to use the `run` keyword to execute the command `npm install -g bats` on the runner. ```yaml jobs: example-job: runs-on: ubuntu-latest steps: - run: npm install -g bats ``` To use a workflow to run a script stored in your repository you must first check out the repository to the runner. Having done this, you can use the `run` keyword to run the script on the runner. The following example runs two scripts, each in a separate job step. The location of the scripts on the runner is specified by setting a default working directory for run commands. For more information, see [AUTOTITLE](/actions/using-jobs/setting-default-values-for-jobs). ```yaml jobs: example-job: runs-on: ubuntu-latest defaults: run: working-directory: ./scripts steps: - name: Check out the repository to the runner uses: {% data reusables.actions.action-checkout %} - name: Run a script run: ./my-script.sh - name: Run another script run: ./my-other-script.sh ``` Any scripts that you want a workflow job to run must be executable. You can do this either within the workflow by passing the script as an argument to the interpreter that will run the script - for example, `run: bash script.sh` - or by making the file itself executable. You can give the file the execute permission by using the command `git update-index --chmod=+x PATH/TO/YOUR/script.sh` locally, then committing and pushing the file to the repository. Alternatively, for workflows that are run on Linux and Mac runners, you can add a command to give the file the execute permission in the workflow job, prior to running the script: ```yaml jobs: example-job: runs-on: ubuntu-latest defaults: run: working-directory: ./scripts steps: - name: Check out the repository to the runner uses: {% data reusables.actions.action-checkout %} - name: Make the script files executable run: chmod +x my-script.sh my-other-script.sh - name: Run the scripts run: | ./my-script.sh ./my-other-script.sh ``` For more information about the `run` keyword, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idstepsrun). | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-what-workflows-do/add-scripts.md | main | github-actions | [
-0.010167776606976986,
-0.032659318298101425,
-0.07538255304098129,
-0.006430948153138161,
0.005098271183669567,
0.01401906181126833,
-0.0009761773981153965,
0.03851472586393356,
-0.0661473423242569,
0.04577751085162163,
0.017566179856657982,
0.007697476539760828,
0.00943275447934866,
0.01... | 0.057069 |
## Creating secrets for a repository {% data reusables.actions.permissions-statement-secrets-variables-repository %} {% webui %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.actions.sidebar-secrets-and-variables %} {% data reusables.actions.actions-secrets-tab %}  1. Click \*\*New repository secret\*\*. 1. In the \*\*Name\*\* field, type a name for your secret. 1. In the \*\*Secret\*\* field, enter the value for your secret. 1. Click \*\*Add secret\*\*. If your repository has environment secrets or can access secrets from the parent organization, then those secrets are also listed on this page. {% endwebui %} {% cli %} To add a repository secret, use the `gh secret set` subcommand. Replace `secret-name` with the name of your secret. ```shell gh secret set SECRET\_NAME ``` The CLI will prompt you to enter a secret value. Alternatively, you can read the value of the secret from a file. ```shell gh secret set SECRET\_NAME < secret.txt ``` To list all secrets for the repository, use the `gh secret list` subcommand. {% endcli %} ## Creating secrets for an environment {% data reusables.actions.permissions-statement-secrets-environment %} {% webui %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.actions.sidebar-environment %} 1. Click on the environment that you want to add a secret to. 1. Under \*\*Environment secrets\*\*, click \*\*Add secret\*\*. 1. Type a name for your secret in the \*\*Name\*\* input box. 1. Enter the value for your secret. 1. Click \*\*Add secret\*\*. {% endwebui %} {% cli %} To add a secret for an environment, use the `gh secret set` subcommand with the `--env` or `-e` flag followed by the environment name. ```shell gh secret set --env ENV\_NAME SECRET\_NAME ``` To list all secrets for an environment, use the `gh secret list` subcommand with the `--env` or `-e` flag followed by the environment name. ```shell gh secret list --env ENV\_NAME ``` {% endcli %} ## Creating secrets for an organization {% data reusables.actions.actions-secrets-variables-repository-access %} {% data reusables.actions.permissions-statement-secrets-and-variables-organization %} {% webui %} {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org\_settings %} {% data reusables.actions.sidebar-secrets-and-variables %} {% data reusables.actions.actions-secrets-tab %}  {% data reusables.actions.secrets-and-variables-org-permissions %} 1. Click \*\*New organization secret\*\*. 1. Type a name for your secret in the \*\*Name\*\* input box. 1. Enter the \*\*Value\*\* for your secret. 1. From the \*\*Repository access\*\* dropdown list, choose an access policy. 1. Click \*\*Add secret\*\*. {% endwebui %} {% cli %} > [!NOTE] > By default, {% data variables.product.prodname\_cli %} authenticates with the `repo` and `read:org` scopes. To manage organization secrets, you must additionally authorize the `admin:org` scope. > > ```shell > gh auth login --scopes "admin:org" > ``` To add a secret for an organization, use the `gh secret set` subcommand with the `--org` or `-o` flag followed by the organization name. ```shell gh secret set --org ORG\_NAME SECRET\_NAME ``` By default, the secret is only available to private repositories. To specify that the secret should be available to all repositories within the organization, use the `--visibility` or `-v` flag. ```shell gh secret set --org ORG\_NAME SECRET\_NAME --visibility all ``` To specify that the secret should be available to selected repositories within the organization, use the `--repos` or `-r` flag. ```shell gh secret set --org ORG\_NAME SECRET\_NAME --repos REPO-NAME-1, REPO-NAME-2 ``` To list all secrets for an organization, use the `gh secret list` subcommand with the `--org` or `-o` flag followed by the organization name. ```shell gh secret list --org ORG\_NAME ``` {% endcli %} ## Reviewing access to organization-level secrets You can check which access | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets.md | main | github-actions | [
-0.07960185408592224,
-0.03302697092294693,
-0.051685817539691925,
0.0927831307053566,
0.003567646723240614,
-0.004191881511360407,
0.05266720429062843,
-0.05086519569158554,
-0.07862217724323273,
0.011983835138380527,
0.07812166959047318,
-0.028525376692414284,
0.037861380726099014,
0.013... | 0.005562 |
SECRET\_NAME --repos REPO-NAME-1, REPO-NAME-2 ``` To list all secrets for an organization, use the `gh secret list` subcommand with the `--org` or `-o` flag followed by the organization name. ```shell gh secret list --org ORG\_NAME ``` {% endcli %} ## Reviewing access to organization-level secrets You can check which access policies are being applied to a secret in your organization. {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org\_settings %} {% data reusables.actions.sidebar-secrets-and-variables %} 1. The list of secrets includes any configured permissions and policies. For more details about the configured permissions for each secret, click \*\*Update\*\*. ## Using secrets in a workflow > [!NOTE] > \* {% data reusables.actions.forked-secrets %} > \* Secrets are not automatically passed to reusable workflows. For more information, see [AUTOTITLE](/actions/using-workflows/reusing-workflows#passing-inputs-and-secrets-to-a-reusable-workflow). > \* Secrets are not available to workflows triggered by {% data variables.product.prodname\_dependabot %} events. For more information, see [AUTOTITLE](/code-security/dependabot/troubleshooting-dependabot/troubleshooting-dependabot-on-github-actions#accessing-secrets). > \* {% data reusables.actions.about-oidc-short-overview %} > [!WARNING] Mask all sensitive information that is not a {% data variables.product.prodname\_dotcom %} secret by using `::add-mask::VALUE`. This causes the value to be treated as a secret and redacted from logs. To provide an action with a secret as an input or environment variable, you can use the `secrets` context to access secrets you've created in your repository. For more information, see [AUTOTITLE](/actions/learn-github-actions/contexts) and [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions). {% raw %} ```yaml steps: - name: Hello world action with: # Set the secret as an input super\_secret: ${{ secrets.SuperSecret }} env: # Or as an environment variable super\_secret: ${{ secrets.SuperSecret }} ``` {% endraw %} Secrets cannot be directly referenced in `if:` conditionals. Instead, consider setting secrets as job-level environment variables, then referencing the environment variables to conditionally run steps in the job. For more information, see [AUTOTITLE](/actions/learn-github-actions/contexts#context-availability) and [`jobs..steps[\*].if`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idstepsif). If a secret has not been set, the return value of an expression referencing the secret (such as {% raw %}`${{ secrets.SuperSecret }}`{% endraw %} in the example) will be an empty string. Avoid passing secrets between processes from the command line, whenever possible. Command-line processes may be visible to other users (using the `ps` command) or captured by [security audit events](https://docs.microsoft.com/windows-server/identity/ad-ds/manage/component-updates/command-line-process-auditing). To help protect secrets, consider using environment variables, `STDIN`, or other mechanisms supported by the target process. If you must pass secrets within a command line, then enclose them within the proper quoting rules. Secrets often contain special characters that may unintentionally affect your shell. To escape these special characters, use quoting with your environment variables. For example: ### Example using Bash {% raw %} ```yaml steps: - shell: bash env: SUPER\_SECRET: ${{ secrets.SuperSecret }} run: | example-command "$SUPER\_SECRET" ``` {% endraw %} ### Example using PowerShell {% raw %} ```yaml steps: - shell: pwsh env: SUPER\_SECRET: ${{ secrets.SuperSecret }} run: | example-command "$env:SUPER\_SECRET" ``` {% endraw %} ### Example using Cmd.exe {% raw %} ```yaml steps: - shell: cmd env: SUPER\_SECRET: ${{ secrets.SuperSecret }} run: | example-command "%SUPER\_SECRET%" ``` {% endraw %} ## Storing large secrets To use secrets that are larger than 48 KB, you can use a workaround to store secrets in your repository and save the decryption passphrase as a secret on {% data variables.product.prodname\_dotcom %}. For example, you can use `gpg` to encrypt a file containing your secret locally before checking the encrypted file in to your repository on {% data variables.product.prodname\_dotcom %}. For more information, see the [gpg manpage](https://www.gnupg.org/gph/de/manual/r1023.html). > [!WARNING] > Be careful that your secrets do not get printed when your workflow runs. When using this workaround, {% data variables.product.prodname\_dotcom %} does not redact secrets that are printed in logs. 1. Run the following command from your terminal to encrypt the file | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets.md | main | github-actions | [
-0.04490527883172035,
-0.019578317180275917,
-0.03841526806354523,
0.026554716750979424,
0.014360534027218819,
-0.009538684040307999,
0.03830409422516823,
-0.10969358682632446,
-0.061430711299180984,
0.005893837660551071,
0.02132701501250267,
0.0037424874026328325,
-0.00015020070713944733,
... | -0.016397 |
information, see the [gpg manpage](https://www.gnupg.org/gph/de/manual/r1023.html). > [!WARNING] > Be careful that your secrets do not get printed when your workflow runs. When using this workaround, {% data variables.product.prodname\_dotcom %} does not redact secrets that are printed in logs. 1. Run the following command from your terminal to encrypt the file containing your secret using `gpg` and the AES256 cipher algorithm. In this example, `my\_secret.json` is the file containing the secret. ```shell gpg --symmetric --cipher-algo AES256 my\_secret.json ``` 1. You will be prompted to enter a passphrase. Remember the passphrase, because you'll need to create a new secret on {% data variables.product.prodname\_dotcom %} that uses the passphrase as the value. 1. Create a new secret that contains the passphrase. For example, create a new secret with the name `LARGE\_SECRET\_PASSPHRASE` and set the value of the secret to the passphrase you used in the step above. 1. Copy your encrypted file to a path in your repository and commit it. In this example, the encrypted file is `my\_secret.json.gpg`. > [!WARNING] > Make sure to copy the encrypted `my\_secret.json.gpg` file ending with the `.gpg` file extension, and \*\*not\*\* the unencrypted `my\_secret.json` file. ```shell git add my\_secret.json.gpg git commit -m "Add new secret JSON file" ``` 1. Create a shell script in your repository to decrypt the secret file. In this example, the script is named `decrypt\_secret.sh`. ```shell copy #!/bin/sh # Decrypt the file mkdir $HOME/secrets # --batch to prevent interactive command # --yes to assume "yes" for questions gpg --quiet --batch --yes --decrypt --passphrase="$LARGE\_SECRET\_PASSPHRASE" \ --output $HOME/secrets/my\_secret.json my\_secret.json.gpg ``` 1. Ensure your shell script is executable before checking it in to your repository. ```shell chmod +x decrypt\_secret.sh git add decrypt\_secret.sh git commit -m "Add new decryption script" git push ``` 1. In your {% data variables.product.prodname\_actions %} workflow, use a `step` to call the shell script and decrypt the secret. To have a copy of your repository in the environment that your workflow runs in, you'll need to use the [`actions/checkout`](https://github.com/actions/checkout) action. Reference your shell script using the `run` command relative to the root of your repository. ```yaml name: Workflows with large secrets on: push jobs: my-job: name: My Job runs-on: ubuntu-latest steps: - uses: {% data reusables.actions.action-checkout %} - name: Decrypt large secret run: ./decrypt\_secret.sh env: LARGE\_SECRET\_PASSPHRASE: {% raw %}${{ secrets.LARGE\_SECRET\_PASSPHRASE }}{% endraw %} # This command is just an example to show your secret being printed # Ensure you remove any print statements of your secrets. GitHub does # not hide secrets that use this workaround. - name: Test printing your secret (Remove this step in production) run: cat $HOME/secrets/my\_secret.json ``` ## Storing Base64 binary blobs as secrets You can use Base64 encoding to store small binary blobs as secrets. You can then reference the secret in your workflow and decode it for use on the runner. For the size limits, see [AUTOTITLE](/actions/security-guides/using-secrets-in-github-actions#limits-for-secrets). > [!NOTE] > \* Note that Base64 only converts binary to text, and is not a substitute for actual encryption. > \* Using another shell might require different commands for decoding the secret to a file. On Windows runners, we recommend [using a bash shell](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idstepsshell) with `shell: bash` to use the commands in the `run` step above. 1. Use `base64` to encode your file into a Base64 string. For example: On macOS, you could run: ```shell base64 -i cert.der -o cert.base64 ``` On Linux, you could run: ```shell base64 -w 0 cert.der > cert.base64 ``` 1. Create a secret that contains the Base64 string. For example: ```shell $ gh secret set CERTIFICATE\_BASE64 < cert.base64 ✓ Set secret CERTIFICATE\_BASE64 for octocat/octorepo ``` 1. To access the Base64 string from | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets.md | main | github-actions | [
-0.1251898556947708,
0.03606170043349266,
-0.05119652301073074,
-0.003496467135846615,
0.04488638415932655,
-0.009958550333976746,
0.06384190171957016,
0.03633992001414299,
-0.053400296717882156,
0.024974768981337547,
-0.020920423790812492,
0.009984146803617477,
0.007090040948241949,
-0.04... | -0.008128 |
cert.der -o cert.base64 ``` On Linux, you could run: ```shell base64 -w 0 cert.der > cert.base64 ``` 1. Create a secret that contains the Base64 string. For example: ```shell $ gh secret set CERTIFICATE\_BASE64 < cert.base64 ✓ Set secret CERTIFICATE\_BASE64 for octocat/octorepo ``` 1. To access the Base64 string from your runner, pipe the secret to `base64 --decode`. For example: ```yaml name: Retrieve Base64 secret on: push: branches: [ octo-branch ] jobs: decode-secret: runs-on: ubuntu-latest steps: - uses: {% data reusables.actions.action-checkout %} - name: Retrieve the secret and decode it to a file env: {% raw %}CERTIFICATE\_BASE64: ${{ secrets.CERTIFICATE\_BASE64 }}{% endraw %} run: | echo $CERTIFICATE\_BASE64 | base64 --decode > cert.der - name: Show certificate information run: | openssl x509 -in cert.der -inform DER -text -noout ``` ## Next steps For reference information, see [AUTOTITLE](/actions/reference/secrets-reference). | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets.md | main | github-actions | [
0.017308002337813377,
0.07636146247386932,
-0.09179891645908356,
0.05975164845585823,
0.023712195456027985,
-0.02118547447025776,
-0.06842395663261414,
0.03618905320763588,
-0.00017420390213374048,
0.0005446516443043947,
0.008913918398320675,
-0.04877613112330437,
-0.013403085060417652,
0.... | -0.038803 |
## Prerequisites To implement jobs in your workflows, you need to understand what jobs are. See [AUTOTITLE](/actions/get-started/understanding-github-actions#jobs). ## Setting an ID for a job {% data reusables.actions.jobs.section-using-jobs-in-a-workflow-id %} ## Setting a name for a job {% data reusables.actions.jobs.section-using-jobs-in-a-workflow-name %} ## Defining prerequisite jobs {% data reusables.actions.jobs.section-using-jobs-in-a-workflow-needs %} ## Using a matrix to run jobs with different variables To automatically run a job with different combinations of variables, such as operating systems or language versions, define a `matrix` strategy in your workflow. For more information, see [AUTOTITLE](/actions/how-tos/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow). | https://github.com/github/docs/blob/main//content/actions/how-tos/write-workflows/choose-what-workflows-do/use-jobs.md | main | github-actions | [
-0.07011976093053818,
-0.058113906532526016,
-0.04543962702155113,
0.020461544394493103,
-0.027303704991936684,
0.01708495244383812,
0.03345218673348427,
-0.04938041418790817,
-0.057745132595300674,
-0.06273732334375381,
-0.059130456298589706,
0.03866283968091011,
0.02799925208091736,
0.00... | 0.112237 |
## Overview If you use {% data variables.enterprise.data\_residency %}, members of your enterprise can create {% data variables.product.prodname\_actions %} workflows that use actions directly from {% data variables.product.prodname\_dotcom\_the\_website %} or [{% data variables.product.prodname\_marketplace %}](https://github.com/marketplace?type=actions). {% data variables.product.prodname\_actions %} searches your enterprise on {% data variables.enterprise.data\_residency\_site %} for each action before falling back to {% data variables.product.prodname\_dotcom\_the\_website %}. This ensures that custom versions of actions in your enterprise are used in preference to their counterparts on {% data variables.product.prodname\_dotcom\_the\_website %}. To ensure workflows use their intended actions and to block the potential for abuse, once an action on {% data variables.product.prodname\_dotcom\_the\_website %} is used for the first time, the namespace associated with that action is retired in your enterprise. This blocks users from creating an organization and repository in your enterprise that match the action's namespace on {% data variables.product.prodname\_dotcom\_the\_website %}. ## Making a retired namespace available After using an action from {% data variables.product.prodname\_dotcom\_the\_website %}, if you want to create an action in your enterprise with the same name, you need to make the namespace for that organization and repository available. {% data reusables.enterprise-accounts.access-enterprise-emu %} {% data reusables.enterprise-accounts.settings-tab %} 1. Under \*\*{% octicon "gear" aria-hidden="true" aria-label="gear" %} Settings\*\*, click \*\*Retired namespaces\*\*. 1. To the right of the namespace that you want use in your enterprise, click \*\*Unretire\*\*. 1. Go to the relevant organization and create a new repository. ### Tips for ensuring you can create a new repository \* When you unretire a namespace, always create the new repository with that name as soon as possible. If a workflow calls the associated action on {% data variables.product.prodname\_dotcom\_the\_website %} before you create the local repository, the namespace will be retired again. \* For actions used in workflows that run frequently, you may find that a namespace is retired again before you have time to create the local repository. In this case, you can temporarily disable the relevant workflows until you have created the new repository. | https://github.com/github/docs/blob/main//content/actions/how-tos/administer/reuse-namespaces-on-ghecom.md | main | github-actions | [
0.010917839594185352,
-0.012208008207380772,
-0.04328245669603348,
0.016186218708753586,
0.0173148512840271,
0.004260961897671223,
0.09872464835643768,
0.017678335309028625,
-0.06591979414224625,
0.01677054911851883,
0.05916876718401909,
-0.009963126853108406,
-0.003637809306383133,
0.0111... | 0.086139 |
## Viewing {% data variables.product.prodname\_actions %} metrics for your organization {% data reusables.actions.actions-metrics-discrepancy-note %} {% data reusables.profile.access\_org %} {% data reusables.user-settings.access\_org %} {% data reusables.organizations.insights %} {% data reusables.actions.viewing-actions-metrics %} ## Viewing {% data variables.product.prodname\_actions %} metrics for your repository {% data reusables.actions.actions-metrics-discrepancy-note %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.navigate-to-insights %} {% data reusables.actions.viewing-actions-metrics %} ## Understanding {% data variables.product.prodname\_actions %} metrics aggregation {% data reusables.actions.about-actions-usage-metrics-aggregation %} | https://github.com/github/docs/blob/main//content/actions/how-tos/administer/view-metrics.md | main | github-actions | [
-0.009401588700711727,
-0.06372208148241043,
-0.061778876930475235,
0.09667886793613434,
0.011132658459246159,
0.007987013086676598,
0.08838433772325516,
0.020389027893543243,
-0.030110806226730347,
0.016487469896674156,
0.0448087714612484,
-0.028257155790925026,
0.01792178861796856,
0.016... | -0.012261 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## Configuring a proxy for Linux and Windows runners If your runner needs to communicate via a proxy server, you can configure proxy settings using environment variables or system-level configurations. {% data reusables.actions.actions-proxy-environment-variables-table %} The proxy environment variables are read when the runner application starts, so you must set the environment variables before configuring or starting the runner application. If your proxy configuration changes, you must restart the runner application. On Windows machines, the proxy environment variable names are case-insensitive. On Linux and macOS machines, we recommend that you use all lowercase environment variables. If you have an environment variable in both lowercase and uppercase on Linux or macOS, for example `https\_proxy` and `HTTPS\_PROXY`, the self-hosted runner application uses the lowercase environment variable. {% data reusables.actions.self-hosted-runner-ports-protocols %} ### Example configurations {% data reusables.actions.environment-variables-as-case-sensitive %} #### Linux and macOS Set proxy environment variables for your runner. ```shell copy export https\_proxy=http://proxy.local:8080 export http\_proxy=http://proxy.local:8080 export no\_proxy=example.com,localhost,127.0.0.1 ``` #### Windows On Windows, you can configure proxy settings either by setting environment variables or by using the [netsh command](https://learn.microsoft.com/en-us/windows/win32/winhttp/netsh-exe-commands#set-advproxy). The netsh approach applies to applications and services that rely on the WinHTTP API. Setting environment variables is still required for runners that use private networking. Whether you also need to configure netsh depends on the applications used in your workflows. ```shell copy netsh winhttp set advproxy setting-scope=machine settings={\"Proxy\":\"proxy.local:8080\",\"ProxyBypass\":\"168.63.129.16;169.254.169.254\",\"AutoconfigUrl\":\"\",\"AutoDetect\":false} ``` When configuring this during custom image generation, use `setting-scope=machine` to ensure the proxy settings persist after reboots and during VM imaging. ### Making proxy settings persistent When setting these environment variables during custom image generation, ensure the configuration persists across reboots or image rebuilds. #### Linux and macOS Write the variables to `/etc/environment`. ```shell echo 'http\_proxy=http://proxy.local' >> /etc/environment ``` #### Windows Set the system-wide environment variables. ```shell copy [Environment]::SetEnvironmentVariable("http\_proxy", "http://proxy.local", "Machine") ``` ## Configuring a proxy for Azure runners If your runner is hosted in Azure, either as a self-hosted runner or a GitHub-hosted larger runner deployed with private networking, you may need to configure a proxy to allow outbound connectivity to GitHub services while maintaining network isolation. You should add Azure metadata and management IPs to your `no\_proxy` list to ensure the runner can access required Azure services. These endpoints allow Azure VMs to retrieve configuration and identity information needed for proper operation. The two Azure IPs are: \* 168.63.129.16 (see [Azure IP address 168.63.129.16 overview](https://learn.microsoft.com/en-us/azure/virtual-network/what-is-ip-address-168-63-129-16?tabs=linux)) \* 169.254.169.254 (see [Azure Instance Metadata Service](https://learn.microsoft.com/en-us/azure/virtual-machines/instance-metadata-service?tabs=linux)) ## Using a .env file to set the proxy configuration > [!NOTE] > Using a `.env` file to set the proxy configuration cannot be done on a GitHub-hosted runner. On self-hosted runners, you can configure proxy settings by adding the variables to a `.env` file in the self-hosted runner application directory (the directory where you downloaded and unpacked the runner software). This approach is useful when the runner is configured to run as a service under a system account. When the runner starts, it reads the variables set in `.env` for the proxy configuration. ### Example `.env` proxy configuration ```shell copy https\_proxy=http://proxy.local:8080 no\_proxy=example.com,myserver.local:443 ``` ## Setting proxy configuration for Docker containers If you use Docker container actions or service containers in your workflows, you might also need to configure Docker to use your proxy server in addition to setting the above environment variables. For information on the required Docker configuration, see [Configure Docker to use a proxy server](https://docs.docker.com/network/proxy/) in the Docker documentation. | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/use-proxy-servers.md | main | github-actions | [
0.0386214479804039,
-0.03119153529405594,
-0.04833979159593582,
0.04579140990972519,
-0.07605919986963272,
-0.029486743733286858,
-0.05023764446377754,
0.0375751368701458,
-0.04604969546198845,
0.014744703657925129,
-0.019464729353785515,
0.024097256362438202,
0.02081635594367981,
0.024749... | 0.008761 |
Docker configuration, see [Configure Docker to use a proxy server](https://docs.docker.com/network/proxy/) in the Docker documentation. | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/use-proxy-servers.md | main | github-actions | [
-0.010716681368649006,
0.00438305176794529,
0.02651212550699711,
-0.035194363445043564,
-0.10634686052799225,
-0.04956328496336937,
-0.028172152116894722,
-0.0204671211540699,
-0.021559007465839386,
0.042159371078014374,
-0.0889890119433403,
0.059823378920555115,
0.027336936444044113,
0.01... | -0.028727 |
## Running jobs on your runner {% linux %} {% data reusables.actions.run-jobs-larger-runners %} {% endlinux %} {% windows %} {% data reusables.actions.run-jobs-larger-runners %} {% endwindows %} {% mac %} Once your runner type has been defined, you can update your workflow YAML files to send jobs to runner instances for processing. To run jobs on macOS {% data variables.actions.hosted\_runner %}s, update the `runs-on` key in your workflow YAML files to use one of the {% data variables.product.company\_short %}-defined labels for macOS runners. For more information, see [Available macOS {% data variables.actions.hosted\_runner %}s](#available-macos-larger-runners). {% endmac %} {% mac %} ## Available macOS {% data variables.actions.hosted\_runner %}s Use the labels in the table below to run your workflows on the corresponding macOS {% data variables.actions.hosted\_runner %}. {% data reusables.actions.larger-runners-table %} > [!NOTE] > For macOS {% data variables.actions.hosted\_runner %}s, the `-latest` runner label uses the macOS 12 runner image. For macOS Xlarge, the `-latest` runner label uses the macOS 13 runner image {% endmac %} {% ifversion repository-actions-runners %} ## Viewing available runners for a repository {% data reusables.actions.about-viewing-runner-list %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.repository-runners %} 1. Review the list of available runners for the repository. {% data reusables.actions.copy-runner-label %} {% data reusables.actions.actions-tab-new-runners-note %} {% endif %} {% linux %} ## Using groups to control where jobs are run {% data reusables.actions.jobs.example-runs-on-groups %} {% endlinux %} {% windows %} ## Using groups to control where jobs are run {% data reusables.actions.jobs.example-runs-on-groups %} {% endwindows %} {% linux %} ## Using labels to control where jobs are run {% data reusables.actions.runner-labels-implicit %} In this example, the `runs-on` key sends the job to any available runner that has been assigned the `ubuntu-20.04-16core` label: ```yaml name: learn-github-actions on: [push] jobs: check-bats-version: runs-on: labels: ubuntu-20.04-16core steps: - uses: {% data reusables.actions.action-checkout %} - uses: {% data reusables.actions.action-setup-node %} with: node-version: '14' - run: npm install -g bats - run: bats -v ``` {% data reusables.actions.runner-labels %} {% endlinux %} {% windows %} ## Using labels to control where jobs are run {% data reusables.actions.runner-labels-implicit %} In this example, the `runs-on` key sends the job to any available runner that has been assigned the `windows-2022-16core` label: ```yaml name: learn-github-actions on: [push] jobs: check-bats-version: runs-on: labels: windows-2022-16core steps: - uses: {% data reusables.actions.action-checkout %} - uses: {% data reusables.actions.action-setup-node %} with: node-version: '14' - run: npm install -g bats - run: bats -v ``` {% data reusables.actions.runner-labels %} {% endwindows %} {% mac %} ## Targeting macOS {% data variables.actions.hosted\_runner %}s in a workflow To run your workflows on macOS {% data variables.actions.hosted\_runner %}s, set the value of the `runs-on` key to a label associated with a macOS {% data variables.actions.hosted\_runner %}. For a list of macOS {% data variables.actions.hosted\_runner %} labels, see [Available macOS {% data variables.actions.hosted\_runner %}s](#available-macos-larger-runners). In this example, the workflow uses a label that is associated with macOS XL runners. The `runs-on` key sends the job to any available runner with a matching label: ```yaml name: learn-github-actions-testing on: [push] jobs: build: runs-on: macos-13-xlarge steps: - uses: {% data reusables.actions.action-checkout %} - name: Build run: swift build - name: Run tests run: swift test ``` {% endmac %} {% linux %} ## Using labels and groups to control where jobs are run {% data reusables.actions.jobs.example-runs-on-labels-and-groups %} {% data reusables.actions.section-using-unique-names-for-runner-groups %} {% endlinux %} {% windows %} ## Using labels and groups to control where jobs are run {% data reusables.actions.jobs.example-runs-on-labels-and-groups %} {% data reusables.actions.section-using-unique-names-for-runner-groups %} {% endwindows %} ## Troubleshooting {% data variables.actions.hosted\_runner %}s {% linux %} {% data reusables.actions.larger-runners-troubleshooting-linux-windows %} {% endlinux %} {% windows %} {% data | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/larger-runners/use-larger-runners.md | main | github-actions | [
0.031062230467796326,
-0.034453216940164566,
-0.013720931485295296,
0.02137121744453907,
0.0032243519090116024,
0.0009422437869943678,
-0.03526921197772026,
-0.01715058460831642,
-0.029017778113484383,
-0.04984443634748459,
-0.021381108090281487,
0.01380979549139738,
-0.05201393738389015,
... | 0.077016 |
%} {% endlinux %} {% windows %} ## Using labels and groups to control where jobs are run {% data reusables.actions.jobs.example-runs-on-labels-and-groups %} {% data reusables.actions.section-using-unique-names-for-runner-groups %} {% endwindows %} ## Troubleshooting {% data variables.actions.hosted\_runner %}s {% linux %} {% data reusables.actions.larger-runners-troubleshooting-linux-windows %} {% endlinux %} {% windows %} {% data reusables.actions.larger-runners-troubleshooting-linux-windows %} {% endwindows %} {% mac %} Because macOS arm64 does not support Node 12, macOS {% data variables.actions.hosted\_runner %}s automatically use Node 16 to execute any JavaScript action written for Node 12. Some community actions may not be compatible with Node 16. If you use an action that requires a different Node version, you may need to manually install a specific version at runtime. > [!NOTE] > ARM-powered runners are currently in {% data variables.release-phases.public\_preview %} and are subject to change. {% endmac %} | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/larger-runners/use-larger-runners.md | main | github-actions | [
0.02248905599117279,
-0.007320019882172346,
-0.02856779284775257,
0.08856777846813202,
0.07067886739969254,
0.005281141027808189,
-0.0376783162355423,
-0.011680462397634983,
-0.08625254780054092,
0.0077001359313726425,
0.049491044133901596,
0.005391336046159267,
-0.039898086339235306,
0.02... | 0.088049 |
{% data reusables.actions.custom-images-public-preview-note %} ## Custom images You can create a custom image to define the exact environment that your {% data variables.actions.github\_hosted\_larger\_runners %} use. Custom images let you preinstall tools, dependencies, and configurations to speed up workflows and improve consistency across jobs. When your runner uses a custom image, it acts as a “pre-warmed” environment, allowing workflows to complete quicker, by downloading packages and binaries once during image creation instead of every time a workflow is run. For more information about custom images, see [Runner images](/actions/concepts/runners/github-hosted-runners#runner-images). The process of using a custom image involves three main steps: 1. [Setting up an image-generation runner](#setting-up-an-image-generation-runner): Create a {% data variables.actions.hosted\_runner %} to build and store your custom image. 1. [Generating a custom image](#generating-a-custom-image): Generate your custom image by running a workflow using the image-generation runner. 1. [Installing custom images](#installing-custom-images): Create a runner that uses your custom image. ## Prerequisites Before you can create custom images, make sure the following requirements are met. \* \*\*Policy\*\*: Custom images must be enabled for your organization or enterprise. Enterprise owners can manage access to custom images and set retention policies in the Actions policy settings. For more information, see [AUTOTITLE](/admin/enforcing-policies/enforcing-policies-for-your-enterprise/enforcing-policies-for-github-actions-in-your-enterprise#custom-images). \* \*\*Permissions\*\*: To create and manage custom images, you must be an organization or enterprise owner, or have the `CI/CD Admin` role, or have a role with the following fine-grained permissions. \* View organization hosted runner custom images \* Manage organization hosted runner custom images \* Manage organization runners and runner groups For more information, see [AUTOTITLE](/organizations/managing-peoples-access-to-your-organization-with-roles/about-custom-organization-roles). ## Setting up an image-generation runner To create a custom image, you must first set up an image-generation runner. When you create the runner, the platform that you select for your runner must match the platform of the image you want to build. The platform of the runner can be Linux x64, Linux ARM64, or Windows x64. 1. Create a {% data variables.actions.hosted\_runner %}: \* For organizations, see [Adding a larger runner to an organization](/actions/how-tos/manage-runners/larger-runners/manage-larger-runners#adding-a-larger-runner-to-an-organization). \* For enterprises, see [Adding a larger runner to an enterprise](/actions/how-tos/manage-runners/larger-runners/manage-larger-runners#adding-a-larger-runner-to-an-enterprise). 1. When configuring the runner, select the following configurations for your image-generation runner: \* \*\*Platform\*\*: Select a supported platform that matches the platform of the image you plan to create (Linux x64, Linux ARM64, or Windows x64). \* \*\*Image\*\*: Select an image to build on, then enable the checkbox \*\*Enable this runner to generate custom images\*\*. \* You can start from a {% data variables.product.github %}-owned image or choose a base image to start from a clean OS. \* For ARM64 platforms, you can also select an ARM-maintained image with preinstalled tooling. \* \*\*Runner group\*\*: Select the group for your runner to be a member of. Once the custom image is created, only runners in this runner group can generate new versions of that image. ## Generating a custom image After you create an image-generation runner, run a workflow that includes the `snapshot` keyword to generate a custom image. To configure a workflow for image generation: \* Set the `runs-on` value to the name of the image-generation runner that you created. \* Add the `snapshot` keyword to the job, using either the string syntax or mapping syntax shown below. \* Each job that includes the `snapshot` keyword creates a separate image. To generate only one image or image version, include all workflow steps in a single job. \* Each successful run of a job that includes the `snapshot` keyword creates a new version of that image. > [!NOTE] > {% data variables.product.company\_short %} recommends configuring image generation as a scheduled workflow on a weekly basis. This approach ensures dependencies remain up-to-date and | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/larger-runners/use-custom-images.md | main | github-actions | [
0.0105818510055542,
-0.023208150640130043,
-0.04007052630186081,
0.09917840361595154,
0.03808356076478958,
-0.04963553324341774,
-0.060342926532030106,
0.06160862371325493,
-0.016086215153336525,
0.038628872483968735,
0.029916564002633095,
0.061466362327337265,
0.060648754239082336,
-0.032... | 0.067013 |
steps in a single job. \* Each successful run of a job that includes the `snapshot` keyword creates a new version of that image. > [!NOTE] > {% data variables.product.company\_short %} recommends configuring image generation as a scheduled workflow on a weekly basis. This approach ensures dependencies remain up-to-date and have the latest security patches. For more information, see [AUTOTITLE](/actions/using-workflows/events-that-trigger-workflows#schedule). It can take some time for your image to be fully generated and ready to use after the workflow completes. Provisioning time varies based on runner size and configuration, and may take several hours for larger runners. The image is generated only when the job completes successfully. This prevents new image versions from being created when a workflow fails or ends in an incomplete state. Once the image is generated, it is available for use in your workflows. For more information about managing custom images, see [Managing custom images](#managing-custom-images). ### String syntax You can use the string syntax with `snapshot` to define the image name. This method creates a new image or adds a new version to an existing image with the same name. You cannot specify a version number using this syntax. ```yaml jobs: build: runs-on: my-image-generation-runner snapshot: my-custom-image steps: # Add any steps to download and setup any dependencies here ``` ### Mapping syntax You can use the mapping syntax with `snapshot` to define both the `image-name` and the optional `version`. When you specify a major version, the minor versioning automatically increments if that major version already exists. Patch versions are not supported. ```yaml jobs: build: runs-on: my-image-generation-runner snapshot: image-name: my-custom-image version: 2.\* steps: # Add any steps to download and setup any dependencies here ``` ## Versioning When you generate custom images, {% data variables.product.github %} automatically assigns version numbers to help you manage updates and track image history. ### Default behavior If an image with the specified name does not exist in your organization or enterprise, {% data variables.product.github %} creates it with an initial version number of 1.0.0. If an image with the same name already exists, {% data variables.product.github %} creates a new version by incrementing the minor version number (for example, 1.1.0, 1.2.0, etc.). If you do not specify a version in your YAML file, image generation uses this default behavior. ### Specifying a version in your workflow If you include a version in the YAML mapping, {% data variables.product.github %} checks the major version number first. \* If the specified major version already exists, the new image uses the next minor version (for example, 1.0 becomes 1.1). \* If the major version does not exist, {% data variables.product.github %} creates a new major version (for example, 2.0). Patch versions are not supported. ### Latest tag The most recent workflow run for an image is always tagged as latest. If you specify an older major version in the YAML (for example, version: 1.\* when a 2.0 version exists), {% data variables.product.github %} generates a new minor version under the older major version and marks it as latest. > [!NOTE] > {% data variables.actions.github\_hosted\_larger\_runner %} creation does not support wildcards in image version selection. ## Managing custom images You can view detailed information about each image, delete unused images or specific versions, and track image versions over time. {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org\_settings %} {% data reusables.organizations.settings-sidebar-actions-custom-images %} 1. On the "Custom images" page, you can view all custom images that have been created in your organization or enterprise. 1. To view details about a specific image, click the image name. ## Installing custom images Once your custom image is ready, you | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/larger-runners/use-custom-images.md | main | github-actions | [
-0.03678108751773834,
0.03578697144985199,
-0.002299166051670909,
0.003941631410270929,
0.0416475273668766,
-0.03469943255186081,
-0.06989089399576187,
0.01902170293033123,
-0.028985196724534035,
-0.04107275605201721,
0.03412356227636337,
0.05413665249943733,
0.052640918642282486,
-0.02616... | 0.047402 |
reusables.organizations.org\_settings %} {% data reusables.organizations.settings-sidebar-actions-custom-images %} 1. On the "Custom images" page, you can view all custom images that have been created in your organization or enterprise. 1. To view details about a specific image, click the image name. ## Installing custom images Once your custom image is ready, you can install it on a new {% data variables.actions.github\_hosted\_larger\_runner %}. 1. Follow the steps for creating a {% data variables.actions.hosted\_runner %}: \* For organizations, see [Adding a larger runner to an organization](/actions/how-tos/manage-runners/larger-runners/manage-larger-runners#adding-a-larger-runner-to-an-organization). \* For enterprises, see [Adding a larger runner to an enterprise](/actions/how-tos/manage-runners/larger-runners/manage-larger-runners#adding-a-larger-runner-to-an-enterprise). 1. When configuring the runner: \* \*\*Platform\*\*: Select the same platform that you used to generate the image (Linux x64, Linux ARM64, or Windows x64). \* \*\*Image\*\*: Select the \*\*Custom\*\* tab, then choose your custom image from the list. \* If you don’t see your image, make sure you’ve selected the correct platform and that you’re creating the runner at the same level (organization or enterprise) where the image was generated. \* \*\*Image version\*\*: Choose \*\*Latest\*\* to automatically use the most recent version, or select a specific version number to pin the runner to that version. \* If you select \*\*Latest\*\*, your runner automatically updates when a new version of the image becomes available. If you pin the runner to a specific version, you’ll need to edit the runner manually to upgrade later. \* \*\*Size\*\*: Choose a runner size with storage equal to or larger than your image’s size. For example, if the image was generated on an 8-core runner, select an 8-core or larger to run this image. \* \*\*Runner group\*\*: Assign the runner to a runner group that is shared with the repositories that need to use this image. 1. In your {% data variables.product.prodname\_actions %} workflow job, set the `runs-on` key to the name of your runner. ```yaml jobs: build: runs-on: my-custom-runner steps: # Add any steps for your workflow here ``` 1. Run your workflow to verify that it completes successfully. The job logs will show the image name and version in the "Set up job" section. | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/larger-runners/use-custom-images.md | main | github-actions | [
0.02657318115234375,
-0.022397346794605255,
-0.07267247140407562,
0.11310634016990662,
0.030572863295674324,
0.002245623618364334,
-0.08638905733823776,
0.042686931788921356,
-0.07270713150501251,
0.058835189789533615,
0.06312432140111923,
0.05829554796218872,
0.030208107084035873,
0.00480... | 0.043022 |
> [!NOTE] > {% data reusables.actions.windows-linux-larger-runners-note %} ## Managing access to larger runners > [!NOTE] > Before your workflows can send jobs to {% data variables.actions.hosted\_runner %}s, you must first configure permissions for the runner group. See the following sections for more information. Runner groups are used to control which repositories can run jobs on your {% data variables.actions.hosted\_runner %}s. You must manage access to the group from each level of the management hierarchy, depending on where you've defined the {% data variables.actions.hosted\_runner %}: \* \*\*Runners at the enterprise level:\*\* {% data reusables.actions.about-enterprise-level-runner-groups %} \* \*\*Runners at the organization level:\*\* {% data reusables.actions.about-organization-level-runner-groups %} For example, the following diagram has a runner group named `grp-ubuntu-20.04-16core` at the enterprise level. Before the repository named `octo-repo` can use the runners in the group, you must first configure the group at the enterprise level to allow access to the `octo-org` organization. You must then configure the group at the organization level to allow access to `octo-repo`.  ## Creating a runner group for an organization {% data reusables.actions.hosted-runner-security-admonition %} {% data reusables.actions.creating-a-runner-group-for-an-organization %} {% ifversion ghec or ghes %} ## Creating a runner group for an enterprise {% data reusables.actions.hosted-runner-security-admonition %} {% data reusables.actions.creating-a-runner-group-for-an-enterprise %} {% endif %} {% data reusables.actions.section-using-unique-names-for-runner-groups %} {% ifversion ghec %} ## Changing which organizations can access a runner group {% data reusables.actions.hosted-runner-security-admonition %} For runner groups in an enterprise, you can change what organizations in the enterprise can access a runner group. {% data reusables.actions.runner-groups-enterprise-navigation %} {% data reusables.actions.changing-organization-access-for-a-runner-group %} {% endif %} ## Changing which repositories can access a runner group {% data reusables.actions.hosted-runner-security-admonition %} For runner groups in an organization, you can change what repositories in the organization can access a runner group. {% data reusables.actions.runner-groups-org-navigation %} {% data reusables.actions.changing-repository-access-for-a-runner-group %} {% ifversion ghec %} ## Changing which workflows can access a runner group {% data reusables.actions.hosted-runner-security-admonition %} {% data reusables.actions.about-restricting-workflow-access-with-runner-groups %} \* [Changing which workflows can access an organization runner group](#changing-which-workflows-can-access-an-organization-runner-group) \* [Changing which workflows can access an enterprise runner group](#changing-which-workflows-can-access-an-enterprise-runner-group) ### Changing which workflows can access an organization runner group {% data reusables.actions.runner-groups-org-navigation %} {% data reusables.actions.changing-workflow-access-for-a-runner-group %} ### Changing which workflows can access an enterprise runner group {% data reusables.actions.runner-groups-enterprise-navigation %} {% data reusables.actions.changing-workflow-access-for-a-runner-group %} {% endif %} {% ifversion actions-private-networking-azure-vnet %} ## Configuring private network access for larger runners {% data reusables.actions.azure-vnet-network-configuration-intro %} If you have configured your {% ifversion ghec %}enterprise or {% endif %}organization to connect to an Azure VNET, you can give runner groups access to the virtual network. For more information, see [AUTOTITLE](/actions/using-github-hosted-runners/connecting-to-a-private-network/about-private-networking-with-github-hosted-runners#using-an-azure-virtual-network-vnet). {% endif %} ## Changing the name of a runner group {% ifversion ghec %} You can rename runner groups at the enterprise and organization levels. \* [Changing the name of an organization runner group](#changing-the-name-of-an-organization-runner-group) \* [Changing the name of an enterprise runner group](#changing-the-name-of-an-enterprise-runner-group) ### Changing the name of an organization runner group {% endif %} {% data reusables.actions.runner-groups-org-navigation %} {% data reusables.actions.changing-the-name-of-a-runner-group %} {% ifversion ghec %} ### Changing the name of an enterprise runner group {% data reusables.actions.runner-groups-enterprise-navigation %} {% data reusables.actions.changing-the-name-of-a-runner-group %} {% endif %} ## Moving a runner to a group {% data reusables.actions.about-moving-a-runner-to-a-group %} {% ifversion ghec %} \* [Moving an organization runner to a group](#moving-an-organization-runner-to-a-group) \* [Moving an enterprise runner to a group](#moving-an-enterprise-runner-to-a-group) ### Moving an organization runner to a group {% endif %} {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org\_settings %} {% data reusables.organizations.settings-sidebar-actions-runners %} {% data reusables.actions.moving-a-runner-to-a-group %} {% ifversion ghec %} ### Moving an enterprise runner | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/larger-runners/control-access.md | main | github-actions | [
0.02714393101632595,
-0.043951015919446945,
-0.08321662247180939,
0.07446799427270889,
-0.005663564428687096,
-0.03747045248746872,
-0.013092969544231892,
-0.001096761436201632,
-0.08689210563898087,
0.010353696532547474,
-0.013812345452606678,
0.010711630806326866,
-0.014455930329859257,
... | 0.052231 |
an organization runner to a group](#moving-an-organization-runner-to-a-group) \* [Moving an enterprise runner to a group](#moving-an-enterprise-runner-to-a-group) ### Moving an organization runner to a group {% endif %} {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org\_settings %} {% data reusables.organizations.settings-sidebar-actions-runners %} {% data reusables.actions.moving-a-runner-to-a-group %} {% ifversion ghec %} ### Moving an enterprise runner to a group {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.enterprise-accounts.actions-runners-tab %} {% data reusables.actions.moving-a-runner-to-a-group %} {% endif %} ## Removing a runner group {% data reusables.actions.about-removing-a-runner-group %} {% ifversion ghec %} \* [Removing a runner group from an organization](#removing-a-runner-group-from-an-organization) \* [Removing a runner group from an enterprise](#removing-a-runner-group-from-an-enterprise) ### Removing a runner group from an organization {% endif %} {% data reusables.actions.runner-groups-org-navigation %} {% data reusables.actions.removing-a-runner-group %} {% ifversion ghec %} ### Removing a runner group from an enterprise {% data reusables.actions.runner-groups-enterprise-navigation %} {% data reusables.actions.removing-a-runner-group %} {% endif %} | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/larger-runners/control-access.md | main | github-actions | [
-0.004744233563542366,
-0.01989961601793766,
-0.03835112974047661,
0.06422308087348938,
0.025506004691123962,
0.016172122210264206,
0.011802115477621555,
-0.09112117439508438,
-0.054299063980579376,
0.04511677846312523,
0.03576609119772911,
0.00482434406876564,
-0.0009676188346929848,
-0.0... | 0.011995 |
> [!NOTE] > \* {% data reusables.actions.windows-linux-larger-runners-note %} {% ifversion ghec %} ## Adding a {% data variables.actions.hosted\_runner %} to an enterprise Enterprise owners can add {% data variables.actions.hosted\_runner %}s to an enterprise and assign them to organizations. By default, when a {% data variables.actions.hosted\_runner %} is created for an enterprise, it is added to a default runner group that all organizations in the enterprise have access to. While all organizations are granted access to the runner, the repositories in each organization \*\*are not\*\* granted access. For each organization, an organization owner must configure the runner group to specify which repositories have access to the enterprise runner. For more information, see [Allowing repositories to access {% data variables.actions.hosted\_runner %}s](#allowing-repositories-to-access-larger-runners). {% data reusables.actions.add-hosted-runner-overview %} {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.enterprise-accounts.actions-runners-tab %} {% data reusables.actions.add-hosted-runner %} {% data reusables.actions.org-access-to-github-hosted-runners %} {% endif %} ## Adding a {% data variables.actions.hosted\_runner %} to an organization Organization owners{% ifversion custom-org-roles %} and users with the "Manage organization runners and runner groups" permission{% endif %} can add a {% data variables.actions.hosted\_runner %} to an organization and control which repositories can use it. When you create a new runner for an organization, by default, all repositories in the organization have access to the runner. To limit which repositories can use the runner, assign it to a runner group with access to specific repositories. For more information, see [Allowing repositories to access larger runners](#allowing-repositories-to-access-larger-runners). {% data reusables.actions.add-hosted-runner-overview %} {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org\_settings %} {% data reusables.organizations.settings-sidebar-actions-runners %} {% data reusables.actions.add-hosted-runner %} 1. To allow repositories to access your {% data variables.actions.hosted\_runner %}s, add them to the list of repositories that can use it. For more information, see [Allowing repositories to access {% data variables.actions.hosted\_runner %}s](#allowing-repositories-to-access-larger-runners). ## Allowing repositories to access {% data variables.actions.hosted\_runner %}s Repositories are granted access to {% data variables.actions.hosted\_runner %}s through runner groups. Enterprise administrators can choose which organizations are granted access to enterprise-level runner groups, and organization owners{% ifversion custom-org-roles %} and users with the "Manage organization runners and runner groups" permission{% endif %} control repository-level access to all {% data variables.actions.hosted\_runner %}s. Organization owners can use and configure enterprise-level runner groups for the repositories in their organization, or they can create organization-level runner groups to control access.{% ifversion custom-org-roles %} Users with the "Manage organization runners and runner groups" can only manage organization-level runner groups. For more information, see [AUTOTITLE](/organizations/managing-peoples-access-to-your-organization-with-roles/about-custom-organization-roles).{% endif %} \* \*\*For enterprise-level runner groups:\*\* {% data reusables.actions.about-enterprise-level-runner-groups %} \* \*\*For organization-level runner groups:\*\* {% data reusables.actions.about-organization-level-runner-groups %} Once a repository has access to {% data variables.actions.hosted\_runner %}s, the {% data variables.actions.hosted\_runner %}s can be added to workflow files. For more information, see [AUTOTITLE](/actions/using-github-hosted-runners/running-jobs-on-larger-runners). {% data reusables.actions.runner-groups-org-navigation %} 1. Select a runner group from either list on the page. Organization-level runner groups are listed at the top of the page, and enterprise-level runner groups are listed under "Shared by the Enterprise." 1. On the runner group page, under "Repository access," select \*\*All repositories\*\* or \*\*Selected repositories\*\*. If you choose to grant access to specific repositories, click {% octicon "gear" aria-label="The Settings gear" %}, then select the repositories you would like to grant access to from the list. > [!WARNING] > {% data reusables.actions.hosted-runner-security %} > For more information, see [AUTOTITLE](/actions/using-github-hosted-runners/controlling-access-to-larger-runners). ## Changing the name of a {% data variables.actions.hosted\_runner %} {% data reusables.actions.larger-runner-name-note %} {% ifversion ghec %} You can edit the name of your {% data variables.actions.hosted\_runner %}s. \* [Changing the name of an organization runner](#changing-the-name-of-an-organization-runner) \* [Changing the name of an enterprise runner](#changing-the-name-of-an-enterprise-runner) ### Changing the name | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/larger-runners/manage-larger-runners.md | main | github-actions | [
0.026580454781651497,
-0.0254584401845932,
-0.06909610331058502,
0.09056495875120163,
-0.005564944818615913,
0.002052856609225273,
-0.02507343329489231,
-0.018960757181048393,
-0.06371495127677917,
0.04939763620495796,
0.027264975011348724,
0.016279563307762146,
-0.035357531160116196,
-0.0... | 0.072226 |
[AUTOTITLE](/actions/using-github-hosted-runners/controlling-access-to-larger-runners). ## Changing the name of a {% data variables.actions.hosted\_runner %} {% data reusables.actions.larger-runner-name-note %} {% ifversion ghec %} You can edit the name of your {% data variables.actions.hosted\_runner %}s. \* [Changing the name of an organization runner](#changing-the-name-of-an-organization-runner) \* [Changing the name of an enterprise runner](#changing-the-name-of-an-enterprise-runner) ### Changing the name of an organization runner {% endif %} {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org\_settings %} {% data reusables.organizations.settings-sidebar-actions-runners %} {% data reusables.actions.select-a-larger-runner %} {% data reusables.actions.rename-larger-runner %} {% ifversion ghec %} ### Changing the name of an enterprise runner {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.enterprise-accounts.actions-runners-tab %} {% data reusables.actions.select-a-larger-runner %} {% data reusables.actions.rename-larger-runner %} {% endif %} ## Changing the size of a {% data variables.actions.hosted\_runner %} {% ifversion ghec %} You can edit the size of your {% data variables.actions.hosted\_runner %}s. \* [Changing the size of an organization runner](#changing-the-size-of-an-organization-runner) \* [Changing the size of an enterprise runner](#changing-the-size-of-an-enterprise-runner) ### Changing the size of an organization runner {% endif %} {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org\_settings %} {% data reusables.organizations.settings-sidebar-actions-runners %} {% data reusables.actions.select-a-larger-runner %} {% data reusables.actions.resize-larger-runner %} {% ifversion ghec %} ### Changing the size of an enterprise runner {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.enterprise-accounts.actions-runners-tab %} {% data reusables.actions.select-a-larger-runner %} {% data reusables.actions.resize-larger-runner %} {% endif %} ## Changing the image of a {% data variables.actions.hosted\_runner %} {% ifversion ghec %} You can edit the image of your {% data variables.actions.hosted\_runner %}s if you are using a {% data variables.product.github %}-owned image. For a list of our managed images see the [{% data variables.product.prodname\_actions %} Runner Images](https://github.com/actions/runner-images) repository. \* [Changing the image of an organization runner](#changing-the-image-of-an-organization-runner) \* [Changing the image of an enterprise runner](#changing-the-image-of-an-enterprise-runner) ### Changing the image of an organization runner {% endif %} {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org\_settings %} {% data reusables.organizations.settings-sidebar-actions-runners %} {% data reusables.actions.select-a-larger-runner %} {% data reusables.actions.reimage-larger-runner %} {% ifversion ghec %} ### Changing the image of an enterprise runner {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.enterprise-accounts.actions-runners-tab %} {% data reusables.actions.select-a-larger-runner %} {% data reusables.actions.reimage-larger-runner %} {% endif %} ## Configuring autoscaling for {% data variables.actions.hosted\_runner %}s You can control the maximum number of jobs allowed to run concurrently for specific runner sets. Setting this field to a higher value can help prevent workflows being blocked due to parallelism. {% ifversion ghec %} \* [Configuring autoscaling for an organization runner](#configuring-autoscaling-for-an-organization-runner) \* [Configuring autoscaling for an enterprise runner](#configuring-autoscaling-for-an-enterprise-runner) ### Configuring autoscaling for an organization runner {% endif %} {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org\_settings %} {% data reusables.organizations.settings-sidebar-actions-runners %} {% data reusables.actions.select-a-larger-runner %} {% data reusables.actions.configure-autoscaling-for-larger-runners %} {% ifversion ghec %} ### Configuring autoscaling for an enterprise runner {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.enterprise-accounts.actions-runners-tab %} {% data reusables.actions.select-a-larger-runner %} {% data reusables.actions.configure-autoscaling-for-larger-runners %} {% endif %} ## Creating static IP addresses for {% data variables.actions.hosted\_runner %}s > [!NOTE] > To use static IP addresses, your organization must use {% data variables.product.prodname\_ghe\_cloud %}. {% data reusables.enterprise.link-to-ghec-trial %} You can enable static IP addresses for {% data variables.actions.hosted\_runner %}s. When you do this, the {% data variables.actions.hosted\_runner %}s are assigned static IP address ranges. All IP addresses in the range assigned are usable. By default, you can configure up to 10 different {% data variables.actions.hosted\_runner %}s with IP ranges for your account. {% data reusables.actions.larger-runner-static-ip-contact-support %} The number of available IP addresses in the assigned ranges does not restrict number of concurrent jobs specified for autoscaling. Within a | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/larger-runners/manage-larger-runners.md | main | github-actions | [
-0.018958231434226036,
-0.007110402453690767,
-0.038131557404994965,
0.045498985797166824,
-0.021737053990364075,
-0.009766453877091408,
-0.046926144510507584,
-0.016946790739893913,
-0.03916812688112259,
0.038004085421562195,
-0.017549630254507065,
0.010109049268066883,
-0.00231920368969440... | 0.056584 |
the range assigned are usable. By default, you can configure up to 10 different {% data variables.actions.hosted\_runner %}s with IP ranges for your account. {% data reusables.actions.larger-runner-static-ip-contact-support %} The number of available IP addresses in the assigned ranges does not restrict number of concurrent jobs specified for autoscaling. Within a runner pool, there is a load balancer which allows for high reuse of the IP addresses in the assigned ranges. This ensures your workflows can run concurrently at scale while each machine is assigned a static IP address. {% ifversion ghec %} \* [Creating static IP addresses for organization runners](#creating-static-ip-addresses-for-organization-runners) \* [Creating static IP addresses for enterprise runners](#creating-static-ip-addresses-for-enterprise-runners) ### Creating static IP addresses for organization runners {% endif %} {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org\_settings %} {% data reusables.organizations.settings-sidebar-actions-runners %} {% data reusables.actions.select-a-larger-runner %} {% data reusables.actions.networking-for-larger-runners %} {% ifversion ghec %} ### Creating static IP addresses for enterprise runners {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.enterprise-accounts.actions-runners-tab %} {% data reusables.actions.select-a-larger-runner %} {% data reusables.actions.networking-for-larger-runners %} {% endif %} | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/larger-runners/manage-larger-runners.md | main | github-actions | [
-0.01421512383967638,
-0.025603896006941795,
-0.06445837765932083,
0.02750595286488533,
-0.054841943085193634,
0.03695467859506607,
-0.04846656322479248,
-0.033328261226415634,
-0.07261035591363907,
-0.02552226185798645,
-0.027846120297908783,
0.013131648302078247,
0.005660770460963249,
0.... | 0.083043 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## Checking access levels You may not be able to create a self-hosted runner for an organization-owned repository. {% data reusables.actions.disable-selfhosted-runners-crossrefs %} ## Checking the status of a self-hosted runner {% data reusables.actions.self-hosted-runner-management-permissions-required %} {% data reusables.actions.self-hosted-runner-navigate-repo-and-org %} {% data reusables.organizations.settings-sidebar-actions-runners %} 1. Under "Runners", you can view a list of registered runners, including the runner's name, labels, and status. The status can be one of the following: \* \*\*Idle:\*\* The runner is connected to {% data variables.product.github %} and is ready to execute jobs. \* \*\*Active:\*\* The runner is currently executing a job. \* \*\*Offline:\*\* The runner is not connected to {% data variables.product.github %}. This could be because the machine is offline, the self-hosted runner application is not running on the machine, or the self-hosted runner application cannot communicate with {% data variables.product.github %}. ## Troubleshooting network connectivity ### Checking self-hosted runner network connectivity You can use the self-hosted runner application's `config` script with the `--check` parameter to check that a self-hosted runner can access all required network services on {% data variables.product.github %}. In addition to `--check`, you must provide two arguments to the script: \* `--url` with the URL to your {% data variables.product.company\_short %} repository, organization, or enterprise. For example, `--url https://github.com/octo-org/octo-repo`. \* `--pat` with the value of a {% data variables.product.pat\_v1 %}, which must have the `workflow` scope, or a {% data variables.product.pat\_v2 %} with workflows read and write access. For example, `--pat ghp\_abcd1234`. For more information, see [AUTOTITLE](/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token). For example: {% mac %} {% data reusables.actions.self-hosted-runner-check-mac-linux %} {% endmac %} {% linux %} {% data reusables.actions.self-hosted-runner-check-mac-linux %} {% endlinux %} {% windows %} ```powershell config.cmd --check --url https://github.com/YOUR-ORG/YOUR-REPO --pat GHP\_ABCD1234 ``` {% endwindows %} The script tests each service, and outputs either a `PASS` or `FAIL` for each one. If you have any failing checks, you can see more details on the problem in the log file for the check. The log files are located in the `\_diag` directory where you installed the runner application, and the path of the log file for each check is shown in the console output of the script. If you have any failing checks, you should also verify that your self-hosted runner machine meets all the communication requirements. For more information, see [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/communicating-with-self-hosted-runners). ### Disabling TLS certificate verification {% ifversion ghes %} By default, the self-hosted runner application verifies the TLS certificate for {% data variables.product.github %}. If {% data variables.location.product\_location\_enterprise %} has a self-signed or internally-issued certificate, you may wish to disable TLS certificate verification for testing purposes. {% else %} By default, the self-hosted runner application verifies the TLS certificate for {% data variables.product.github %}. If you encounter network problems, you may wish to disable TLS certificate verification for testing purposes. {% endif %} To disable TLS certification verification in the self-hosted runner application, set the `GITHUB\_ACTIONS\_RUNNER\_TLS\_NO\_VERIFY` environment variable to `1` before configuring and running the self-hosted runner application. {% linux %} ```shell export GITHUB\_ACTIONS\_RUNNER\_TLS\_NO\_VERIFY=1 ./config.sh --url https://github.com/YOUR-ORG/YOUR-REPO --token ./run.sh ``` {% endlinux %} {% mac %} ```shell export GITHUB\_ACTIONS\_RUNNER\_TLS\_NO\_VERIFY=1 ./config.sh --url https://github.com/YOUR-ORG/YOUR-REPO --token ./run.sh ``` {% endmac %} {% windows %} ```powershell [Environment]::SetEnvironmentVariable('GITHUB\_ACTIONS\_RUNNER\_TLS\_NO\_VERIFY', '1') ./config.cmd --url https://github.com/YOUR-ORG/YOUR-REPO --token ./run.cmd ``` {% endwindows %} > [!WARNING] > Disabling TLS verification is not recommended since TLS provides privacy and data integrity between the self-hosted runner application and {% data variables.product.github %}. We recommend that you install the {% data variables.product.github %} certificate in the operating system certificate store for your self-hosted runner. For guidance on how to install the {% data variables.product.github %} certificate, check with your operating system vendor. {% ifversion | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/monitor-and-troubleshoot.md | main | github-actions | [
0.0071223219856619835,
-0.054407112300395966,
-0.0884820818901062,
0.1127072423696518,
0.028984863311052322,
-0.0157774668186903,
-0.0304701067507267,
-0.013181616552174091,
-0.07766466587781906,
0.024491872638463974,
0.018605651333928108,
0.0019401311874389648,
0.015428257174789906,
-0.02... | 0.099249 |
the self-hosted runner application and {% data variables.product.github %}. We recommend that you install the {% data variables.product.github %} certificate in the operating system certificate store for your self-hosted runner. For guidance on how to install the {% data variables.product.github %} certificate, check with your operating system vendor. {% ifversion fpt or ghec %} > [!NOTE] > For {% data variables.actions.github\_hosted\_larger\_runners %} using Azure private networking, see the TLS interception requirements in [AUTOTITLE](/organizations/managing-organization-settings/configuring-private-networking-for-github-hosted-runners-in-your-organization#prerequisites). {% endif %} ## Reviewing the self-hosted runner application log files You can monitor the status of the self-hosted runner application and its activities. Log files are kept in the `\_diag` directory where you installed the runner application, and a new log is generated each time the application is started. The filename begins with `Runner\_`, and is followed by a UTC timestamp of when the application was started. > [!WARNING] > Runner application log files for ephemeral runners must be forwarded and preserved externally for troubleshooting and diagnostic purposes. For more information about ephemeral runners and autoscaling self-hosted runners, see [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/autoscaling-with-self-hosted-runners#using-ephemeral-runners-for-autoscaling). For detailed logs on workflow job executions, see the next section describing the `Worker\_` files. ## Reviewing a job's log file The self-hosted runner application creates a detailed log file for each job that it processes. These files are stored in the `\_diag` directory where you installed the runner application, and the filename begins with `Worker\_`. {% linux %} ## Using journalctl to check the self-hosted runner application service For Linux-based self-hosted runners running the application using a service, you can use `journalctl` to monitor their real-time activity. The default systemd-based service uses the following naming convention: `actions.runner.-..service`. This name is truncated if it exceeds 80 characters, so the preferred way of finding the service's name is by checking the \_.service\_ file. For example: ```shell $ cat ~/actions-runner/.service actions.runner.octo-org-octo-repo.runner01.service ``` If this fails due to the service being installed elsewhere, you can find the service name in the list of running services. For example, on most Linux systems you can use the `systemctl` command: ```shell $ systemctl --type=service | grep actions.runner actions.runner.octo-org-octo-repo.hostname.service loaded active running GitHub Actions Runner (octo-org-octo-repo.hostname) ``` You can use `journalctl` to monitor the real-time activity of the self-hosted runner: ```shell sudo journalctl -u actions.runner.octo-org-octo-repo.runner01.service -f ``` In this example output, you can see `runner01` start, receive a job named `testAction`, and then display the resulting status: ```shell Feb 11 14:57:07 runner01 runsvc.sh[962]: Starting Runner listener with startup type: service Feb 11 14:57:07 runner01 runsvc.sh[962]: Started listener process Feb 11 14:57:07 runner01 runsvc.sh[962]: Started running service Feb 11 14:57:16 runner01 runsvc.sh[962]: √ Connected to GitHub Feb 11 14:57:17 runner01 runsvc.sh[962]: 2020-02-11 14:57:17Z: Listening for Jobs Feb 11 16:06:54 runner01 runsvc.sh[962]: 2020-02-11 16:06:54Z: Running job: testAction Feb 11 16:07:10 runner01 runsvc.sh[962]: 2020-02-11 16:07:10Z: Job testAction completed with result: Succeeded ``` To view the `systemd` configuration, you can locate the service file here: `/etc/systemd/system/actions.runner.-..service`. If you want to customize the self-hosted runner application service, do not directly modify this file. Follow the instructions described in [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/configuring-the-self-hosted-runner-application-as-a-service#customizing-the-self-hosted-runner-service). {% endlinux %} {% mac %} ## Using `launchd` to check the self-hosted runner application service For macOS-based self-hosted runners running the application as a service, you can use `launchctl` to monitor their real-time activity. The default launchd-based service uses the following naming convention: `actions.runner.-.`. This name is truncated if it exceeds 80 characters, so the preferred way of finding the service's name is by checking the \_.service\_ file in the runner directory: ```shell % cat ~/actions-runner/.service /Users/exampleUsername/Library/LaunchAgents/actions.runner.octo-org-octo-repo.runner01.plist ``` The `svc.sh` script uses `launchctl` to check whether the application is running. For example: ```shell $ ./svc.sh status status actions.runner.example.runner01: | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/monitor-and-troubleshoot.md | main | github-actions | [
0.03693094104528427,
-0.00458163907751441,
-0.05152413994073868,
0.031215449795126915,
-0.007378551177680492,
-0.037201013416051865,
-0.06110520288348198,
-0.007468638475984335,
0.028212925419211388,
0.061316750943660736,
0.008808732964098454,
0.0088278129696846,
0.04185304790735245,
0.039... | 0.028378 |
if it exceeds 80 characters, so the preferred way of finding the service's name is by checking the \_.service\_ file in the runner directory: ```shell % cat ~/actions-runner/.service /Users/exampleUsername/Library/LaunchAgents/actions.runner.octo-org-octo-repo.runner01.plist ``` The `svc.sh` script uses `launchctl` to check whether the application is running. For example: ```shell $ ./svc.sh status status actions.runner.example.runner01: /Users/exampleUsername/Library/LaunchAgents/actions.runner.example.runner01.plist Started: 379 0 actions.runner.example.runner01 ``` The resulting output includes the process ID and the name of the application’s `launchd` service. To view the `launchd` configuration, you can locate the service file here: `/Users/exampleUsername/Library/LaunchAgents/actions.runner...service`. If you want to customize the self-hosted runner application service, do not directly modify this file. Follow the instructions described in [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/configuring-the-self-hosted-runner-application-as-a-service#customizing-the-self-hosted-runner-service-1). {% endmac %} {% windows %} ## Using PowerShell to check the self-hosted runner application service For Windows-based self-hosted runners running the application as a service, you can use PowerShell to monitor their real-time activity. The service uses the naming convention `GitHub Actions Runner (-.)`. You can also find the service's name by checking the \_.service\_ file in the runner directory: ```powershell PS C:\actions-runner> Get-Content .service actions.runner.octo-org-octo-repo.runner01.service ``` You can view the status of the runner in the Windows \_Services\_ application (`services.msc`). You can also use PowerShell to check whether the service is running: ```powershell PS C:\actions-runner> Get-Service "actions.runner.octo-org-octo-repo.runner01.service" | Select-Object Name, Status Name Status ---- ------ actions.runner.octo-org-octo-repo.runner01.service Running ``` You can use PowerShell to check the recent activity of the self-hosted runner. In this example output, you can see the application start, receive a job named `testAction`, and then display the resulting status: ```powershell PS C:\actions-runner> Get-EventLog -LogName Application -Source ActionsRunnerService Index Time EntryType Source InstanceID Message ----- ---- --------- ------ ---------- ------- 136 Mar 17 13:45 Information ActionsRunnerService 100 2020-03-17 13:45:48Z: Job Greeting completed with result: Succeeded 135 Mar 17 13:45 Information ActionsRunnerService 100 2020-03-17 13:45:34Z: Running job: testAction 134 Mar 17 13:41 Information ActionsRunnerService 100 2020-03-17 13:41:54Z: Listening for Jobs 133 Mar 17 13:41 Information ActionsRunnerService 100 û Connected to GitHub 132 Mar 17 13:41 Information ActionsRunnerService 0 Service started successfully. 131 Mar 17 13:41 Information ActionsRunnerService 100 Starting Actions Runner listener 130 Mar 17 13:41 Information ActionsRunnerService 100 Starting Actions Runner Service 129 Mar 17 13:41 Information ActionsRunnerService 100 create event log trace source for actions-runner service ``` {% endwindows %} ## Monitoring the automatic update process We recommend that you regularly check the automatic update process, as the self-hosted runner will not be able to process jobs if it falls below a certain version threshold. The self-hosted runner application automatically updates itself, but note that this process does not include any updates to the operating system or other software; you will need to separately manage these updates. You can view the update activities in the `Runner\_` log files. For example: ```shell [Feb 12 12:37:07 INFO SelfUpdater] An update is available. ``` In addition, you can find more information in the \_SelfUpdate\_ log files located in the `\_diag` directory where you installed the runner application. {% linux %} ## Troubleshooting containers in self-hosted runners ### Checking that Docker is installed If your jobs require containers, then the self-hosted runner must be Linux-based and needs to have Docker installed. Check that your self-hosted runner has Docker installed and that the service is running. You can use `systemctl` to check the service status: ```shell $ sudo systemctl is-active docker.service active ``` If Docker is not installed, then dependent actions will fail with the following errors: ```shell [2020-02-13 16:56:10Z INFO DockerCommandManager] Which: 'docker' [2020-02-13 16:56:10Z INFO DockerCommandManager] Not found. [2020-02-13 16:56:10Z ERR StepsRunner] Caught exception from step: System.IO.FileNotFoundException: File not found: 'docker' ``` ### Checking the Docker permissions If your job fails with | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/monitor-and-troubleshoot.md | main | github-actions | [
-0.0072731878608465195,
-0.017569122835993767,
-0.10217715799808502,
-0.05718642473220825,
0.0015058639692142606,
-0.024776514619588852,
-0.01015129778534174,
0.06040044501423836,
0.060782838612794876,
0.0021914835087955,
-0.029288744553923607,
-0.018155016005039215,
-0.06015341728925705,
... | 0.095111 |
Docker is not installed, then dependent actions will fail with the following errors: ```shell [2020-02-13 16:56:10Z INFO DockerCommandManager] Which: 'docker' [2020-02-13 16:56:10Z INFO DockerCommandManager] Not found. [2020-02-13 16:56:10Z ERR StepsRunner] Caught exception from step: System.IO.FileNotFoundException: File not found: 'docker' ``` ### Checking the Docker permissions If your job fails with the following error: ```shell dial unix /var/run/docker.sock: connect: permission denied ``` Check that the self-hosted runner's service account has permission to use the Docker service. You can identify this account by checking the configuration of the self-hosted runner in `systemd`. For example: ```shell $ sudo systemctl show -p User actions.runner.octo-org-octo-repo.runner01.service User=runner-user ``` {% endlinux %} {% ifversion ghes %} ## Resolving runners that are offline after an upgrade of {% data variables.product.prodname\_ghe\_server %} {% data reusables.actions.upgrade-runners-before-upgrade-ghes %} If your runners are offline for this reason, manually update the runners. For more information, see the installation instructions for [the latest release](https://github.com/actions/runner/releases/latest) in the actions/runner repository. {% endif %} ### Checking which Docker engine is installed on the runner If your build fails with the following error: ```shell Error: Input required and not supplied: java-version ``` Check which Docker engine is installed on your self-hosted runner. To pass the inputs of an action into the Docker container, the runner uses environment variables that might contain dashes as part of their names. The action may not be able to get the inputs if the Docker engine is not a binary executable, but is instead a shell wrapper or a link (for example, a Docker engine installed on Linux using `snap`). To address this error, configure your self-hosted runner to use a different Docker engine. To check if your Docker engine was installed using `snap`, use the `which` command. In the following example, the Docker engine was installed using `snap`: ```shell $ which docker /snap/bin/docker ``` | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/monitor-and-troubleshoot.md | main | github-actions | [
-0.02643625997006893,
0.0519985593855381,
-0.01955454982817173,
-0.06179281696677208,
0.03796442225575447,
-0.0550122894346714,
-0.046223901212215424,
0.030199062079191208,
-0.013180028647184372,
0.06307125836610794,
-0.03404416888952255,
-0.04134432226419449,
-0.021856846287846565,
0.0964... | 0.027559 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## About pre- and post-job scripts You can automatically execute scripts on a self-hosted runner, either before a job runs, or after a job finishes running. You could use these scripts to support the job's requirements, such as building or tearing down a runner environment, or cleaning out directories. You could also use these scripts to track telemetry of how your runners are used. The custom scripts are automatically triggered when a specific environment variable is set on the runner; the environment variable must contain the absolute path to the script. For more information, see [Triggering the scripts](#triggering-the-scripts) below. The following scripting languages are supported: \* \*\*Bash:\*\* Uses `bash` and can fallback to `sh`. Executes by running `-e {pathtofile}`. \* \*\*PowerShell:\*\* Uses `pwsh` and can fallback to `powershell`. Executes by running `-command \". '{pathtofile}'\"`. ## Writing the scripts Your custom scripts can use the following features: \* \*\*Variables:\*\* Scripts have access to the default variables. The full webhook event payload can be found in `GITHUB\_EVENT\_PATH`. For more information, see [AUTOTITLE](/actions/reference/variables-reference#default-environment-variables). \* \*\*Workflow commands:\*\* Scripts can use workflow commands. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-commands-for-github-actions). Scripts can also use environment files. For more information, see [Environment files](/actions/using-workflows/workflow-commands-for-github-actions#environment-files). Your script files must use a file extension for the relevant language, such as `.sh` or `.ps1`, in order to run successfully. > [!NOTE] > Avoid using your scripts to output sensitive information to the console, as anyone with read access to the repository might be able to see the output in the UI logs. ### Handling exit codes For pre-job scripts, exit code `0` indicates that the script completed successfully, and the job will then proceed to run. If there is any other exit code, the job will not run and will be marked as failed. To see the results of your pre-job scripts, check the logs for `Set up runner` entries. For more information on checking the logs, see [AUTOTITLE](/actions/monitoring-and-troubleshooting-workflows/using-workflow-run-logs#viewing-logs-to-diagnose-failures). The [`continue-on-error`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idcontinue-on-error) setting is not supported for use by these scripts. ## Triggering the scripts The custom scripts must be located on the runner, but should not be stored in the `actions-runner` application directory. The scripts are executed in the security context of the service account that's running the runner service. > [!NOTE] > The triggered scripts are processed synchronously, so they will block job execution while they are running. The scripts are automatically executed when the runner has the following environment variables containing an absolute path to the script: \* `ACTIONS\_RUNNER\_HOOK\_JOB\_STARTED`: The script defined in this environment variable is triggered when a job has been assigned to a runner, but before the job starts running. \* `ACTIONS\_RUNNER\_HOOK\_JOB\_COMPLETED`: The script defined in this environment variable is triggered at the end of the job, after all the steps defined in the workflow have run. To set these environment variables, you can either add them to the operating system, or add them to a file named `.env` within the self-hosted runner application directory (that is, the directory into which you downloaded and unpacked the runner software). Note that any change to the `.env` file will require restarting the runner. For example, the following `.env` entry will have the runner automatically run a script, saved as `/opt/runner/cleanup\_script.sh` on the runner machine, before each job runs: ```bash ACTIONS\_RUNNER\_HOOK\_JOB\_STARTED=/opt/runner/cleanup\_script.sh ``` > [!NOTE] > The script defined in `ACTIONS\_RUNNER\_HOOK\_JOB\_COMPLETED` is executed at the end of the job, before the job completes. This makes it unsuitable for use cases that may interrupt a runner, such as deleting the runner machine as part of an autoscaling implementation. ## Troubleshooting ### Permission denied If you get a "permission | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/run-scripts.md | main | github-actions | [
0.01750917360186577,
-0.03192077949643135,
-0.06297466903924942,
0.09761250019073486,
0.010619648732244968,
-0.04682907834649086,
-0.03534824401140213,
0.0011328626424074173,
0.013007674366235733,
0.06463197618722916,
-0.03564777970314026,
0.03836917132139206,
0.0012021425645798445,
-0.025... | 0.098375 |
script defined in `ACTIONS\_RUNNER\_HOOK\_JOB\_COMPLETED` is executed at the end of the job, before the job completes. This makes it unsuitable for use cases that may interrupt a runner, such as deleting the runner machine as part of an autoscaling implementation. ## Troubleshooting ### Permission denied If you get a "permission denied" error when you attempt to run a script, make sure that the script is executable. For example, in a terminal on Linux or macOS you can use the following command to make a file executable. ```bash chmod +x PATH/TO/FILE ``` For information about using workflows to run scripts, see [AUTOTITLE](/actions/writing-workflows/choosing-what-your-workflow-does/adding-scripts-to-your-workflow). ### No timeout setting There is currently no timeout setting available for scripts executed by `ACTIONS\_RUNNER\_HOOK\_JOB\_STARTED` or `ACTIONS\_RUNNER\_HOOK\_JOB\_COMPLETED`. As a result, you could consider adding timeout handling to your script. ### Reviewing the workflow run log To confirm whether your scripts are executing, you can review the logs for that job. The scripts will be listed within separate steps for either `Set up runner` or `Complete runner`, depending on which environment variable is triggering the script. For more information on checking the logs, see [AUTOTITLE](/actions/monitoring-and-troubleshooting-workflows/using-workflow-run-logs#viewing-logs-to-diagnose-failures). | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/run-scripts.md | main | github-actions | [
-0.006787208840250969,
0.02358417771756649,
-0.06520617753267288,
0.015459259040653706,
0.046417318284511566,
-0.025413038209080696,
-0.08957750350236893,
0.03151104226708412,
0.011994564905762672,
0.002656008582562208,
-0.0008622584864497185,
0.032591015100479126,
-0.047076769173145294,
-... | 0.085986 |
{% data reusables.actions.enterprise-github-hosted-runners %} For information on how to use labels to route jobs to specific types of self-hosted runners, see [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/using-self-hosted-runners-in-a-workflow). You can also route jobs to runners in a specific group. For more information, see [AUTOTITLE](/actions/using-jobs/choosing-the-runner-for-a-job#targeting-runners-in-a-group). {% data reusables.actions.self-hosted-runner-management-permissions-required %} > [!NOTE] > Actions Runner Controller does not support multiple labels, to find out more please read our [Actions Runner Controller documentation](/actions/hosting-your-own-runners/managing-self-hosted-runners-with-actions-runner-controller/about-actions-runner-controller#using-arc-runners-in-a-workflow) ## Creating a custom label You can create custom labels for runners at the repository{% ifversion ghec or ghes %}, organization, and enterprise{% else %} and organization{% endif %} levels. \* [Creating a custom label for a repository runner](#creating-a-custom-label-for-a-repository-runner) \* [Creating a custom label for an organization runner](#creating-a-custom-label-for-an-organization-runner){% ifversion ghec or ghes %} \* [Creating a custom label for an enterprise runner](#creating-a-custom-label-for-an-enterprise-runner){% endif %} > [!NOTE] > Labels are case-insensitive. ### Creating a custom label for a repository runner {% data reusables.actions.self-hosted-runner-navigate-to-repo %} {% data reusables.actions.self-hosted-runners-create-label-steps %} ### Creating a custom label for an organization runner {% data reusables.actions.self-hosted-runner-navigate-to-org %} {% data reusables.actions.self-hosted-runners-create-label-steps %} {% ifversion ghec or ghes %} ### Creating a custom label for an enterprise runner {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.enterprise-accounts.actions-runners-tab %} {% data reusables.actions.self-hosted-runners-create-label-steps %} {% endif %} ## Assigning a label to a self-hosted runner You can assign labels to self-hosted runners at the repository{% ifversion ghec or ghes %}, organization, and enterprise{% else %} and organization{% endif %} levels. \* [Assigning a label to a repository runner](#assigning-a-label-to-a-repository-runner) \* [Assigning a label to an organization runner](#assigning-a-label-to-an-organization-runner){% ifversion ghec or ghes %} \* [Assigning a label to an enterprise runner](#assigning-a-label-to-an-enterprise-runner){% endif %} ### Assigning a label to a repository runner {% data reusables.actions.self-hosted-runner-navigate-to-repo %} {% data reusables.actions.self-hosted-runner-assign-label-steps %} ### Assigning a label to an organization runner {% data reusables.actions.self-hosted-runner-navigate-to-org %} {% data reusables.actions.self-hosted-runner-assign-label-steps %} {% ifversion ghec or ghes %} ### Assigning a label to an enterprise runner {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.enterprise-accounts.actions-runners-tab %} {% data reusables.actions.settings-sidebar-actions-runner-selection %} {% data reusables.actions.self-hosted-runner-assign-label-steps %} {% endif %} ## Removing a custom label from a self-hosted runner You can remove custom labels from self-hosted runners at the repository{% ifversion ghec or ghes %}, organization, and enterprise{% else %} and organization{% endif %} levels. \* [Removing a custom label from a repository runner](#removing-a-custom-label-from-a-repository-runner) \* [Removing a custom label from an organization runner](#removing-a-custom-label-from-an-organization-runner){% ifversion ghec or ghes %} \* [Removing a custom label from an enterprise runner](#removing-a-custom-label-from-an-enterprise-runner){% endif %} ### Removing a custom label from a repository runner {% data reusables.actions.self-hosted-runner-navigate-to-repo %} {% data reusables.actions.self-hosted-runner-remove-label-steps %} ### Removing a custom label from an organization runner {% data reusables.actions.self-hosted-runner-navigate-to-org %} {% data reusables.actions.self-hosted-runner-remove-label-steps %} {% ifversion ghec or ghes %} ### Removing a custom label from an enterprise runner {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.enterprise-accounts.actions-runners-tab %} {% data reusables.actions.settings-sidebar-actions-runner-selection %} {% data reusables.actions.self-hosted-runner-remove-label-steps %} {% endif %} ## Programmatically assign labels You can programmatically assign labels to a self-hosted runner after the runner is created, or during its initial configuration. \* To programmatically assign labels to an existing self-hosted runner, you must use the REST API. For more information, see [AUTOTITLE](/rest/actions/self-hosted-runners). \* To programmatically assign labels to a self-hosted runner during the initial runner configuration, you can pass label names to the `config` script using the `labels` parameter. > [!NOTE] > You cannot use the `config` script to assign labels to an existing self-hosted runner. For example, this command assigns a label named `gpu` when configuring a new self-hosted runner: ```shell ./config.sh --url --token --labels gpu ``` The label | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/apply-labels.md | main | github-actions | [
-0.010037271305918694,
-0.03884723410010338,
-0.13013744354248047,
0.08304832130670547,
0.01775890588760376,
0.0722300186753273,
0.031996555626392365,
-0.013384371995925903,
-0.01012313924729824,
-0.03603657707571983,
0.01536815520375967,
-0.014784297905862331,
-0.005526617635041475,
0.025... | 0.133913 |
names to the `config` script using the `labels` parameter. > [!NOTE] > You cannot use the `config` script to assign labels to an existing self-hosted runner. For example, this command assigns a label named `gpu` when configuring a new self-hosted runner: ```shell ./config.sh --url --token --labels gpu ``` The label is created if it does not already exist. You can also use this approach to assign the default labels to runners, such as `x64` or `linux`. When default labels are assigned using the configuration script, {% data variables.product.prodname\_actions %} accepts them as given and does not validate that the runner is actually using that operating system or architecture. You can use comma separation to assign multiple labels. For example: ```shell ./config.sh --url --token --labels gpu,x64,linux ``` > [!NOTE] > If you replace an existing runner, then you must reassign any custom labels. | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/apply-labels.md | main | github-actions | [
0.03493474796414375,
0.000403527490561828,
-0.12122873961925507,
-0.006449033971875906,
0.0068465000949800014,
0.049061909317970276,
0.0631178542971611,
0.09109143912792206,
-0.07300156354904175,
-0.04915329068899155,
0.04913133755326271,
-0.0652616024017334,
0.029041333124041557,
-0.04618... | 0.090842 |
{% data reusables.actions.enterprise-github-hosted-runners %} {% ifversion repository-actions-runners %} ## Viewing available runners for a repository {% data reusables.actions.about-viewing-runner-list %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.repository-runners %} 1. Click the \*\*Self hosted\*\* tab at the top of the list of runners. 1. Review the list of available self-hosted runners for the repository. This list includes both self-hosted runners and runner scale sets created with {% data variables.product.prodname\_actions\_runner\_controller %}. For more information, see [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners-with-actions-runner-controller/about-actions-runner-controller). {% data reusables.actions.copy-runner-label %} {% data reusables.actions.actions-tab-new-runners-note %} {% endif %} ## Using default labels to route jobs A self-hosted runner automatically receives certain labels when it is added to {% data variables.product.prodname\_actions %}. These are used to indicate its operating system and hardware platform: \* `self-hosted`: Default label applied to self-hosted runners. \* `linux`, `windows`, or `macOS`: Applied depending on operating system. \* `x64`, `ARM`, or `ARM64`: Applied depending on hardware architecture. You can use your workflow's YAML to send jobs to a combination of these labels. In this example, a self-hosted runner that matches all three labels will be eligible to run the job: ```yaml runs-on: [self-hosted, linux, ARM64] ``` \* `self-hosted` - Run this job on a self-hosted runner. \* `linux` - Only use a Linux-based runner. \* `ARM64` - Only use a runner based on ARM64 hardware. To create individual self-hosted runners without the default labels, pass the `--no-default-labels` flag when you create the runner. Actions Runner Controller does not support multiple labels. ## Using custom labels to route jobs You can create custom labels and assign them to your self-hosted runners at any time. Custom labels let you send jobs to particular types of self-hosted runners, based on how they're labeled. For example, if you have a job that requires a specific type of graphics hardware, you can create a custom label called `gpu` and assign it to the runners that have the hardware installed. A self-hosted runner that matches all the assigned labels will then be eligible to run the job. This example shows a job that combines default and custom labels: ```yaml runs-on: [self-hosted, linux, x64, gpu] ``` \* `self-hosted` - Run this job on a self-hosted runner. \* `linux` - Only use a Linux-based runner. \* `x64` - Only use a runner based on x64 hardware. \* `gpu` - This custom label has been manually assigned to self-hosted runners with the GPU hardware installed. These labels operate cumulatively, so a self-hosted runner must have all four labels to be eligible to process the job. ## Using groups to route jobs {% data reusables.actions.jobs.example-runs-on-groups %} ## Using labels and groups to route jobs {% data reusables.actions.jobs.example-runs-on-labels-and-groups %} | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/use-in-a-workflow.md | main | github-actions | [
-0.007401264738291502,
-0.06525859236717224,
-0.09297807514667511,
0.10036316514015198,
0.03969189152121544,
0.026895688846707344,
-0.01342795416712761,
0.02508397400379181,
-0.02743634209036827,
0.0363512746989727,
0.05281902104616165,
0.007345760241150856,
0.012484695762395859,
-0.017780... | 0.095243 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## Creating a self-hosted runner group for an organization {% data reusables.actions.self-hosted-runner-security-admonition %} {% data reusables.actions.creating-a-runner-group-for-an-organization %} {% ifversion ghec or ghes %} ## Creating a self-hosted runner group for an enterprise {% data reusables.actions.self-hosted-runner-security-admonition %} {% data reusables.actions.creating-a-runner-group-for-an-enterprise %} {% endif %} {% ifversion ghec or ghes %} ## Changing which organizations can access a runner group {% data reusables.actions.self-hosted-runner-security-admonition %} For runner groups in an enterprise, you can change what organizations in the enterprise can access a runner group. {% data reusables.actions.runner-groups-enterprise-navigation %} {% data reusables.actions.changing-organization-access-for-a-runner-group %} {% endif %} ## Changing which repositories can access a runner group {% data reusables.actions.self-hosted-runner-security-admonition %} For runner groups in an organization, you can change what repositories in the organization can access a runner group. {% data reusables.actions.runner-groups-org-navigation %} {% data reusables.actions.changing-repository-access-for-a-runner-group %} {% ifversion ghec or ghes %} ## Changing which workflows can access a runner group {% data reusables.actions.self-hosted-runner-security-admonition %} {% data reusables.actions.about-restricting-workflow-access-with-runner-groups %} \* [Changing which workflows can access an organization runner group](#changing-which-workflows-can-access-an-organization-runner-group) \* [Changing which workflows can access an enterprise runner group](#changing-which-workflows-can-access-an-enterprise-runner-group) ### Changing which workflows can access an organization runner group {% data reusables.actions.runner-groups-org-navigation %} {% data reusables.actions.changing-workflow-access-for-a-runner-group %} ### Changing which workflows can access an enterprise runner group {% data reusables.actions.runner-groups-enterprise-navigation %} {% data reusables.actions.changing-workflow-access-for-a-runner-group %} {% endif %} ## Changing the name of a runner group {% ifversion ghes or ghec %} You can edit the name of your runner groups at the enterprise and organization levels. \* [Changing the name of an organization runner group](#changing-the-name-of-an-organization-runner-group) \* [Changing the name of an enterprise runner group](#changing-the-name-of-an-enterprise-runner-group) ### Changing the name of an organization runner group {% endif %} {% data reusables.actions.runner-groups-org-navigation %} {% data reusables.actions.changing-the-name-of-a-runner-group %} {% ifversion ghes or ghec %} ### Changing the name of an enterprise runner group {% data reusables.actions.runner-groups-enterprise-navigation %} {% data reusables.actions.changing-the-name-of-a-runner-group %} {% endif %} ## Automatically adding a self-hosted runner to a group {% data reusables.actions.automatically-adding-a-runner-to-a-group %} ## Moving a self-hosted runner to a group {% data reusables.actions.about-moving-a-runner-to-a-group %} {% ifversion ghes or ghec %} \* [Moving an organization runner to a group](#moving-an-organization-runner-to-a-group) \* [Moving an enterprise runner to a group](#moving-an-enterprise-runner-to-a-group) ### Moving an organization runner to a group {% endif %} {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org\_settings %} {% data reusables.organizations.settings-sidebar-actions-runners %} {% data reusables.actions.moving-a-runner-to-a-group %} {% ifversion ghes or ghec %} ### Moving an enterprise runner to a group {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.enterprise-accounts.actions-runners-tab %} {% data reusables.actions.moving-a-runner-to-a-group %} {% endif %} ## Removing a self-hosted runner group {% data reusables.actions.about-removing-a-runner-group %} {% ifversion ghes or ghec %} \* [Removing a runner group from an organization](#removing-a-runner-group-from-an-organization) \* [Removing a runner group from an enterprise](#removing-a-runner-group-from-an-enterprise) ### Removing a runner group from an organization {% endif %} {% data reusables.actions.runner-groups-org-navigation %} {% data reusables.actions.removing-a-runner-group %} {% ifversion ghes or ghec %} ### Removing a runner group from an enterprise {% data reusables.actions.runner-groups-enterprise-navigation %} {% data reusables.actions.removing-a-runner-group %} {% endif %} {% data reusables.actions.section-using-unique-names-for-runner-groups %} | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/manage-access.md | main | github-actions | [
0.009563063271343708,
0.01004393957555294,
-0.07793564349412918,
0.07146517932415009,
0.02153150364756584,
-0.014411554671823978,
-0.030155695974826813,
-0.04718857258558273,
-0.059083208441734314,
0.03397565335035324,
0.037878528237342834,
-0.014755458571016788,
0.01029940415173769,
-0.01... | 0.077458 |
> [!WARNING] > {% data reusables.actions.self-hosted-runner-security %} > > For more information, see [AUTOTITLE](/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions). {% data reusables.actions.enterprise-github-hosted-runners %} ## Prerequisites Before you add a self-hosted runner, you should understand what they are and how they work. See [AUTOTITLE](/actions/concepts/runners/about-self-hosted-runners). Additionally, you must meet the following requirements: {% data reusables.actions.self-hosted-runners-prerequisites %} ## Adding a self-hosted runner to a repository You can add self-hosted runners to a single repository. To add a self-hosted runner to a user repository, you must be the repository owner. For an organization repository, {% ifversion custom-org-roles %}you must be an organization owner, have admin access to the repository, or have the “Manage organization runners and runner groups” permission.{% else %}you must be an organization owner or have admin access to the repository.{% endif %} {% ifversion custom-org-roles %}For more information about custom organization roles, see [AUTOTITLE](/organizations/managing-peoples-access-to-your-organization-with-roles/about-custom-organization-roles).{% endif %} For information about how to add a self-hosted runner with the REST API, see [AUTOTITLE](/rest/actions/self-hosted-runners). > [!NOTE] > {% data reusables.actions.disable-selfhosted-runners-crossrefs %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.settings-sidebar-actions-runners %} 1. Click \*\*New self-hosted runner\*\*. {% data reusables.actions.self-hosted-runner-configure %} {% data reusables.actions.self-hosted-runner-check-installation-success %} For more information, see [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/monitoring-and-troubleshooting-self-hosted-runners). ## Adding a self-hosted runner to an organization You can add self-hosted runners at the organization level, where they can be used to process jobs for multiple repositories in an organization. To add a self-hosted runner to an organization, you must be an organization owner{% ifversion custom-org-roles %} or have the "Manage organization runners and runner groups" permission{% endif %}. For information about how to add a self-hosted runner with the REST API, see [AUTOTITLE](/rest/actions/self-hosted-runners). {% ifversion custom-org-roles %}For more information about custom organization roles, see [AUTOTITLE](/organizations/managing-peoples-access-to-your-organization-with-roles/about-custom-organization-roles).{% endif %} {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org\_settings %} {% data reusables.organizations.settings-sidebar-actions-runners %} {% ifversion actions-hosted-runners %}1. Click \*\*New runner\*\*, then click \*\*New self-hosted runner\*\*.{% else %}1. Click \*\*New runner\*\*.{% endif %} {% data reusables.actions.self-hosted-runner-configure %} {% data reusables.actions.self-hosted-runner-check-installation-success %} For more information, see [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/monitoring-and-troubleshooting-self-hosted-runners). {% data reusables.actions.self-hosted-runner-public-repo-access %} ## Adding a self-hosted runner to an enterprise {% ifversion fpt %}If you use {% data variables.product.prodname\_ghe\_cloud %}, you{% elsif ghec or ghes %}You{% endif %} can add self-hosted runners to an enterprise, where they can be assigned to multiple organizations. The organization owner can control which repositories can use it. {% ifversion fpt %}For more information, see the [{% data variables.product.prodname\_ghe\_cloud %} documentation](/enterprise-cloud@latest/actions/hosting-your-own-runners/managing-self-hosted-runners/adding-self-hosted-runners#adding-a-self-hosted-runner-to-an-enterprise).{% endif %} {% ifversion ghec or ghes %} New runners are assigned to the default group. You can modify the runner's group after you've registered the runner. For more information, see [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/managing-access-to-self-hosted-runners-using-groups#moving-a-self-hosted-runner-to-a-group). To add a self-hosted runner to an enterprise, you must be an enterprise owner. For information about how to add a self-hosted runner with the REST API, see the enterprise endpoints in the [{% data variables.product.prodname\_actions %} REST API](/rest/actions/self-hosted-runners). {% data reusables.actions.self-hosted-runner-add-to-enterprise %} {% data reusables.actions.self-hosted-runner-check-installation-success %} For more information, see [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/monitoring-and-troubleshooting-self-hosted-runners). {% data reusables.actions.self-hosted-runner-public-repo-access %} ### Making enterprise runners available to repositories By default, runners in an enterprise's "Default" self-hosted runner group are available to all organizations in the enterprise, but are not available to all repositories in each organization. To make an enterprise-level self-hosted runner group available to an organization repository, you might need to change the organization's inherited settings for the runner group to make the runner available to repositories in the organization. For more information on changing runner group access settings, see [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/managing-access-to-self-hosted-runners-using-groups#changing-the-access-policy-of-a-self-hosted-runner-group). {% endif %} ## Next steps You can set up automation to scale the number of self-hosted runners. For more information, see [AUTOTITLE](/actions/reference/self-hosted-runners-reference#autoscaling). | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/add-runners.md | main | github-actions | [
0.002924761502072215,
-0.004959973972290754,
-0.07652894407510757,
0.0765024796128273,
0.025187747552990913,
-0.00259195314720273,
-0.033068396151065826,
0.04511794447898865,
-0.057317741215229034,
0.03808555006980896,
0.00775507465004921,
-0.03328203409910202,
0.037974074482917786,
0.0182... | 0.098119 |
organization. For more information on changing runner group access settings, see [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/managing-access-to-self-hosted-runners-using-groups#changing-the-access-policy-of-a-self-hosted-runner-group). {% endif %} ## Next steps You can set up automation to scale the number of self-hosted runners. For more information, see [AUTOTITLE](/actions/reference/self-hosted-runners-reference#autoscaling). | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/add-runners.md | main | github-actions | [
0.03417457640171051,
0.008506094105541706,
-0.0465472936630249,
0.06491197645664215,
-0.035596948117017746,
-0.005934168118983507,
-0.08694427460432053,
0.009987955912947655,
-0.020038487389683723,
0.023523101583123207,
-0.05280088260769844,
-0.0006460912991315126,
-0.02446269989013672,
0.... | 0.102391 |
{% data reusables.actions.enterprise-github-hosted-runners %} {% capture service\_first\_step %}1. Stop the self-hosted runner application if it is currently running.{% endcapture %} {% capture service\_non\_windows\_intro\_shell %}On the runner machine, open a shell in the directory where you installed the self-hosted runner application. Use the commands below to install and manage the self-hosted runner service.{% endcapture %} {% capture service\_nonwindows\_intro %} > [!NOTE] > You must add a runner to {% data variables.product.github %} before you can configure the self-hosted runner application as a service. For more information, see [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/adding-self-hosted-runners). {% endcapture %} {% capture service\_win\_name %}actions.runner.\*{% endcapture %} {% linux %} {{ service\_nonwindows\_intro }} For Linux systems that use `systemd`, you can use the `svc.sh` script that is created after successfully adding the runner to install and manage using the application as a service. {{ service\_non\_windows\_intro\_shell }} {% endlinux %} {% windows %} > [!NOTE] > Configuring the self-hosted runner application as a service on Windows is part of the application configuration process. If you have already configured the self-hosted runner application but did not choose to configure it as a service, you must remove the runner from {% data variables.product.prodname\_dotcom %} and re-configure the application. When you re-configure the application, choose the option to configure the application as a service. > > For more information, see [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/removing-self-hosted-runners) and [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/adding-self-hosted-runners). You can manage the runner service in the Windows \*\*Services\*\* application, or you can use PowerShell to run the commands below. {% endwindows %} {% mac %} {{ service\_nonwindows\_intro }} {{ service\_non\_windows\_intro\_shell }} {% endmac %} {% linux %} ## Installing the service {{ service\_first\_step }} 1. Install the service with the following command: ```shell sudo ./svc.sh install ``` 1. Alternatively, the command takes an optional `user` argument to install the service as a different user. ```shell ./svc.sh install USERNAME ``` {% endlinux %} {% mac %} ## Installing the service {{ service\_first\_step }} 1. Install the service with the following command: ```shell ./svc.sh install ``` {% endmac %} ## Starting the service Start the service with the following command: {% linux %} ```shell sudo ./svc.sh start ``` > [!NOTE] > On Debian-based Linux systems (such as Debian or Ubuntu) with `needrestart` enabled, you can prevent `needrestart` from restarting the runner service during a workflow job by configuring it to ignore the runner service. Run the following command: > > ```bash > echo '$nrconf{override\_rc}{qr(^actions\.runner\..+\.service$)} = 0;' | sudo tee /etc/needrestart/conf.d/actions\_runner\_services.conf > ``` {% endlinux %} {% windows %} ```shell Start-Service "{{ service\_win\_name }}" ``` {% endwindows %} {% mac %} ```shell ./svc.sh start ``` {% endmac %} ## Checking the status of the service Check the status of the service with the following command: {% linux %} ```shell sudo ./svc.sh status ``` {% endlinux %} {% windows %} ```shell Get-Service "{{ service\_win\_name }}" ``` {% endwindows %} {% mac %} ```shell ./svc.sh status ``` {% endmac %} For more information on viewing the status of your self-hosted runner, see [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/monitoring-and-troubleshooting-self-hosted-runners). ## Stopping the service Stop the service with the following command: {% linux %} ```shell sudo ./svc.sh stop ``` {% endlinux %} {% windows %} ```shell Stop-Service "{{ service\_win\_name }}" ``` {% endwindows %} {% mac %} ```shell ./svc.sh stop ``` {% endmac %} ## Uninstalling the service 1. Stop the service if it is currently running. 1. Uninstall the service with the following command: {% linux %} ```shell sudo ./svc.sh uninstall ``` {% endlinux %} {% windows %} ```shell Remove-Service "{{ service\_win\_name }}" ``` {% endwindows %} {% mac %} ```shell ./svc.sh uninstall ``` {% endmac %} {% linux %} ## Customizing the self-hosted runner service If you don't want to | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/configure-the-application.md | main | github-actions | [
0.02885517105460167,
-0.045037563890218735,
-0.045187368988990784,
0.022694194689393044,
0.004068492911756039,
-0.0061440421268343925,
-0.051145922392606735,
0.06947360932826996,
-0.0291802566498518,
0.042808692902326584,
-0.012545903213322163,
-0.005193445831537247,
0.009862479753792286,
... | 0.096383 |
the following command: {% linux %} ```shell sudo ./svc.sh uninstall ``` {% endlinux %} {% windows %} ```shell Remove-Service "{{ service\_win\_name }}" ``` {% endwindows %} {% mac %} ```shell ./svc.sh uninstall ``` {% endmac %} {% linux %} ## Customizing the self-hosted runner service If you don't want to use the above default `systemd` service configuration, you can create a customized service or use whichever service mechanism you prefer. Consider using the `serviced` template at `actions-runner/bin/actions.runner.service.template` as a reference. If you use a customized service, the self-hosted runner service must always be invoked using the `runsvc.sh` entry point. {% endlinux %} {% mac %} ## Customizing the self-hosted runner service If you don't want to use the above default launchd service configuration, you can create a customized service or use whichever service mechanism you prefer. Consider using the `plist` template at `actions-runner/bin/actions.runner.plist.template` as a reference. If you use a customized service, the self-hosted runner service must always be invoked using the `runsvc.sh` entry point. {% endmac %} | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/configure-the-application.md | main | github-actions | [
-0.013776851817965508,
0.02528238855302334,
-0.04390836879611015,
-0.003837005700916052,
0.02094476856291294,
-0.004610559903085232,
-0.06300026178359985,
0.03572969511151314,
0.023607555776834488,
0.0590125173330307,
-0.03942091017961502,
0.04688587039709091,
-0.08472907543182373,
0.02823... | 0.110644 |
> [!NOTE] > This feature is currently in {% data variables.release-phases.public\_preview %} and is subject to change. {% data reusables.actions.enterprise-github-hosted-runners %} ## About container customization {% data variables.product.prodname\_actions %} allows you to run a job within a container, using the `container:` statement in your workflow file. For more information, see [AUTOTITLE](/actions/using-jobs/running-jobs-in-a-container). To process container-based jobs, the self-hosted runner creates a container for each job. {% data variables.product.prodname\_actions %} supports commands that let you customize the way your containers are created by the self-hosted runner. For example, you can use these commands to manage the containers through Kubernetes or Podman, and you can also customize the `docker run` or `docker create` commands used to invoke the container. The customization commands are run by a script, which is automatically triggered when a specific environment variable is set on the runner. For more information, see [Triggering the customization script](#triggering-the-customization-script) below. This customization is only available for Linux-based self-hosted runners, and root user access is not required. ## Container customization commands {% data variables.product.prodname\_actions %} includes the following commands for container customization: \* [`prepare\_job`](/actions/hosting-your-own-runners/managing-self-hosted-runners/customizing-the-containers-used-by-jobs#prepare\_job): Called when a job is started. \* [`cleanup\_job`](/actions/hosting-your-own-runners/managing-self-hosted-runners/customizing-the-containers-used-by-jobs#cleanup\_job): Called at the end of a job. \* [`run\_container\_step`](/actions/hosting-your-own-runners/managing-self-hosted-runners/customizing-the-containers-used-by-jobs#run\_container\_step): Called once for each container action in the job. \* [`run\_script\_step`](/actions/hosting-your-own-runners/managing-self-hosted-runners/customizing-the-containers-used-by-jobs#run\_script\_step): Runs any step that is not a container action. Each of these customization commands must be defined in its own JSON file. The file name must match the command name, with the extension `.json`. For example, the `prepare\_job` command is defined in `prepare\_job.json`. These JSON files will then be run together on the self-hosted runner, as part of the main `index.js` script. This process is described in more detail in [Generating the customization script](#generating-the-customization-script). These commands also include configuration arguments, explained below in more detail. ### `prepare\_job` The `prepare\_job` command is called when a job is started. {% data variables.product.prodname\_actions %} passes in any job or service containers the job has. This command will be called if you have any service or job containers in the job. {% data variables.product.prodname\_actions %} assumes that you will do the following tasks in the `prepare\_job` command: \* Prune anything from previous jobs, if needed. \* Create a network, if needed. \* Pull the job and service containers. \* Start the job container. \* Start the service containers. \* Write to the response file any information that {% data variables.product.prodname\_actions %} will need: \* Required: State whether the container is an `alpine` linux container (using the `isAlpine` boolean). \* Optional: Any context fields you want to set on the job context, otherwise they will be unavailable for users to use. For more information, see [AUTOTITLE](/actions/learn-github-actions/contexts#job-context). \* Return `0` when the health checks have succeeded and the job/service containers are started. #### Arguments for `prepare\_job` \* `jobContainer`: \*\*Optional\*\*. An object containing information about the specified job container. \* `image`: \*\*Required\*\*. A string containing the Docker image. \* `workingDirectory`: \*\*Required\*\*. A string containing the absolute path of the working directory. \* `createOptions`: \*\*Optional\*\*. The optional \_create\_ options specified in the YAML. For more information, see [AUTOTITLE](/actions/using-jobs/running-jobs-in-a-container#example-running-a-job-within-a-container). \* `environmentVariables`: \*\*Optional\*\*. Sets a map of key environment variables. \* `userMountVolumes`: \*\*Optional\*\*. An array of user mount volumes set in the YAML. For more information, see [AUTOTITLE](/actions/using-jobs/running-jobs-in-a-container#example-running-a-job-within-a-container). \* `sourceVolumePath`: \*\*Required\*\*. The source path to the volume that will be mounted into the Docker container. \* `targetVolumePath`: \*\*Required\*\*. The target path to the volume that will be mounted into the Docker container. \* `readOnly`: \*\*Required\*\*. Determines whether or not the mount should be read-only. \* `systemMountVolumes`: \*\*Required\*\*. An array of mounts to mount into the container, same fields as above. \* `sourceVolumePath`: | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/customize-containers.md | main | github-actions | [
0.011612956412136555,
-0.002485426841303706,
-0.04881567507982254,
0.047288186848163605,
0.009448649361729622,
-0.00891561433672905,
-0.017840128391981125,
0.02619667537510395,
-0.04784119129180908,
0.023878946900367737,
-0.05378860980272293,
0.004348545800894499,
-0.00944633036851883,
-0.... | 0.131522 |
the Docker container. \* `targetVolumePath`: \*\*Required\*\*. The target path to the volume that will be mounted into the Docker container. \* `readOnly`: \*\*Required\*\*. Determines whether or not the mount should be read-only. \* `systemMountVolumes`: \*\*Required\*\*. An array of mounts to mount into the container, same fields as above. \* `sourceVolumePath`: \*\*Required\*\*. The source path to the volume that will be mounted into the Docker container. \* `targetVolumePath`: \*\*Required\*\*. The target path to the volume that will be mounted into the Docker container. \* `readOnly`: \*\*Required\*\*. Determines whether or not the mount should be read-only. \* `registry` \*\*Optional\*\*. The Docker registry credentials for a private container registry. \* `username`: \*\*Optional\*\*. The username of the registry account. \* `password`: \*\*Optional\*\*. The password to the registry account. \* `serverUrl`: \*\*Optional\*\*. The registry URL. \* `portMappings`: \*\*Optional\*\*. A key value hash of \_source:target\_ ports to map into the container. \* `services`: \*\*Optional\*\*. An array of service containers to spin up. \* `contextName`: \*\*Required\*\*. The name of the service in the Job context. \* `image`: \*\*Required\*\*. A string containing the Docker image. \* `createOptions`: \*\*Optional\*\*. The optional \_create\_ options specified in the YAML. For more information, see [AUTOTITLE](/actions/using-jobs/running-jobs-in-a-container#example-running-a-job-within-a-container). \* `environmentVariables`: \*\*Optional\*\*. Sets a map of key environment variables. \* `userMountVolumes`: \*\*Optional\*\*. An array of mounts to mount into the container, same fields as above. \* `sourceVolumePath`: \*\*Required\*\*. The source path to the volume that will be mounted into the Docker container. \* `targetVolumePath`: \*\*Required\*\*. The target path to the volume that will be mounted into the Docker container. \* `readOnly`: \*\*Required\*\*. Determines whether or not the mount should be read-only. \* `registry` \*\*Optional\*\*. The Docker registry credentials for the private container registry. \* `username`: \*\*Optional\*\*. The username of the registry account. \* `password`: \*\*Optional\*\*. The password to the registry account. \* `serverUrl`: \*\*Optional\*\*. The registry URL. \* `portMappings`: \*\*Optional\*\*. A key value hash of \_source:target\_ ports to map into the container. #### Example input for `prepare\_job` ```json copy { "command": "prepare\_job", "responseFile": "/users/octocat/runner/\_work/{guid}.json", "state": {}, "args": { "jobContainer": { "image": "node:18" "workingDirectory": "/\_\_w/octocat-test2/octocat-test2", "createOptions": "--cpus 1", "environmentVariables": { "NODE\_ENV": "development" }, "userMountVolumes": [ { "sourceVolumePath": "my\_docker\_volume", "targetVolumePath": "/volume\_mount", "readOnly": false } ], "systemMountVolumes": [ { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work", "targetVolumePath": "/\_\_w", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/externals", "targetVolumePath": "/\_\_e", "readOnly": true }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_temp", "targetVolumePath": "/\_\_w/\_temp", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_actions", "targetVolumePath": "/\_\_w/\_actions", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_tool", "targetVolumePath": "/\_\_w/\_tool", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_temp/\_github\_home", "targetVolumePath": "/github/home", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_temp/\_github\_workflow", "targetVolumePath": "/github/workflow", "readOnly": false } ], "registry": { "username": "octocat", "password": "examplePassword", "serverUrl": "https://index.docker.io/v1" }, "portMappings": { "80": "801" } }, "services": [ { "contextName": "redis", "image": "redis", "createOptions": "--cpus 1", "environmentVariables": {}, "userMountVolumes": [], "portMappings": { "80": "801" }, "registry": { "username": "octocat", "password": "examplePassword", "serverUrl": "https://index.docker.io/v1" } } ] } } ``` #### Example output for `prepare\_job` This example output is the contents of the `responseFile` defined in the input above. ```json copy { "state": { "network": "example\_network\_53269bd575972817b43f7733536b200c", "jobContainer": "82e8219701fe096a35941d869cf3d71af1d943b5d8bdd718857fb87ac3042480", "serviceContainers": { "redis": "60972d9aa486605e66b0dad4abb678dc3d9116f536579e418176eedb8abb9105" } }, "context": { "container": { "id": "82e8219701fe096a35941d869cf3d71af1d943b5d8bdd718857fb87ac3042480", "network": "example\_network\_53269bd575972817b43f7733536b200c" }, "services": { "redis": { "id": "60972d9aa486605e66b0dad4abb678dc3d9116f536579e418176eedb8abb9105", "ports": { "8080": "8080" }, "network": "example\_network\_53269bd575972817b43f7733536b200c" } }, "isAlpine": true } } ``` ### `cleanup\_job` The `cleanup\_job` command is called at the end of a job. {% data variables.product.prodname\_actions %} assumes that you will do the following tasks in the `cleanup\_job` command: \* Stop any running service or job containers (or the equivalent pod). \* Stop the network (if one exists). \* Delete any job or service containers (or the equivalent pod). \* Delete the network (if one exists). \* Cleanup anything else that was created | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/customize-containers.md | main | github-actions | [
0.04706435650587082,
0.008787380531430244,
-0.02676478773355484,
-0.005948062986135483,
-0.02359357289969921,
-0.012720845639705658,
-0.005832947790622711,
0.013257259503006935,
0.011838020756840706,
0.009389483369886875,
-0.061775390058755875,
-0.09866867959499359,
0.030411772429943085,
-... | -0.028621 |
following tasks in the `cleanup\_job` command: \* Stop any running service or job containers (or the equivalent pod). \* Stop the network (if one exists). \* Delete any job or service containers (or the equivalent pod). \* Delete the network (if one exists). \* Cleanup anything else that was created for the job. #### Arguments for `cleanup\_job` No arguments are provided for `cleanup\_job`. #### Example input for `cleanup\_job` ```json copy { "command": "cleanup\_job", "responseFile": null, "state": { "network": "example\_network\_53269bd575972817b43f7733536b200c", "jobContainer": "82e8219701fe096a35941d869cf3d71af1d943b5d8bdd718857fb87ac3042480", "serviceContainers": { "redis": "60972d9aa486605e66b0dad4abb678dc3d9116f536579e418176eedb8abb9105" } }, "args": {} } ``` #### Example output for `cleanup\_job` No output is expected for `cleanup\_job`. ### `run\_container\_step` The `run\_container\_step` command is called once for each container action in your job. {% data variables.product.prodname\_actions %} assumes that you will do the following tasks in the `run\_container\_step` command: \* Pull or build the required container (or fail if you cannot). \* Run the container action and return the exit code of the container. \* Stream any step logs output to stdout and stderr. \* Cleanup the container after it executes. #### Arguments for `run\_container\_step` \* `image`: \*\*Optional\*\*. A string containing the docker image. Otherwise a dockerfile must be provided. \* `dockerfile`: \*\*Optional\*\*. A string containing the path to the dockerfile, otherwise an image must be provided. \* `entryPointArgs`: \*\*Optional\*\*. A list containing the entry point args. \* `entryPoint`: \*\*Optional\*\*. The container entry point to use if the default image entrypoint should be overwritten. \* `workingDirectory`: \*\*Required\*\*. A string containing the absolute path of the working directory. \* `createOptions`: \*\*Optional\*\*. The optional \_create\_ options specified in the YAML. For more information, see [AUTOTITLE](/actions/using-jobs/running-jobs-in-a-container#example-running-a-job-within-a-container). \* `environmentVariables`: \*\*Optional\*\*. Sets a map of key environment variables. \* `prependPath`: \*\*Optional\*\*. An array of additional paths to prepend to the `$PATH` variable. \* `userMountVolumes`: \*\*Optional\*\*. an array of user mount volumes set in the YAML. For more information, see [AUTOTITLE](/actions/using-jobs/running-jobs-in-a-container#example-running-a-job-within-a-container). \* `sourceVolumePath`: \*\*Required\*\*. The source path to the volume that will be mounted into the Docker container. \* `targetVolumePath`: \*\*Required\*\*. The target path to the volume that will be mounted into the Docker container. \* `readOnly`: \*\*Required\*\*. Determines whether or not the mount should be read-only. \* `systemMountVolumes`: \*\*Required\*\*. An array of mounts to mount into the container, using the same fields as above. \* `sourceVolumePath`: \*\*Required\*\*. The source path to the volume that will be mounted into the Docker container. \* `targetVolumePath`: \*\*Required\*\*. The target path to the volume that will be mounted into the Docker container. \* `readOnly`: \*\*Required\*\*. Determines whether or not the mount should be read-only. \* `registry` \*\*Optional\*\*. The Docker registry credentials for a private container registry. \* `username`: \*\*Optional\*\*. The username of the registry account. \* `password`: \*\*Optional\*\*. The password to the registry account. \* `serverUrl`: \*\*Optional\*\*. The registry URL. \* `portMappings`: \*\*Optional\*\*. A key value hash of the \_source:target\_ ports to map into the container. #### Example input for image If you're using a Docker image, you can specify the image name in the `"image":` parameter. ```json copy { "command": "run\_container\_step", "responseFile": null, "state": { "network": "example\_network\_53269bd575972817b43f7733536b200c", "jobContainer": "82e8219701fe096a35941d869cf3d71af1d943b5d8bdd718857fb87ac3042480", "serviceContainers": { "redis": "60972d9aa486605e66b0dad4abb678dc3d9116f536579e418176eedb8abb9105" } }, "args": { "image": "node:18", "dockerfile": null, "entryPointArgs": ["-f", "/dev/null"], "entryPoint": "tail", "workingDirectory": "/\_\_w/octocat-test2/octocat-test2", "createOptions": "--cpus 1", "environmentVariables": { "NODE\_ENV": "development" }, "prependPath": ["/foo/bar", "bar/foo"], "userMountVolumes": [ { "sourceVolumePath": "my\_docker\_volume", "targetVolumePath": "/volume\_mount", "readOnly": false } ], "systemMountVolumes": [ { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work", "targetVolumePath": "/\_\_w", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/externals", "targetVolumePath": "/\_\_e", "readOnly": true }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_temp", "targetVolumePath": "/\_\_w/\_temp", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_actions", "targetVolumePath": "/\_\_w/\_actions", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_tool", "targetVolumePath": "/\_\_w/\_tool", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_temp/\_github\_home", "targetVolumePath": "/github/home", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_temp/\_github\_workflow", "targetVolumePath": | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/customize-containers.md | main | github-actions | [
-0.06463707238435745,
0.03857402130961418,
0.005261649843305349,
-0.004018450155854225,
0.015185930766165257,
-0.09254618734121323,
0.012462501414120197,
-0.09110505878925323,
0.018768267706036568,
0.04493945091962814,
0.020816681906580925,
0.019847000017762184,
-0.031383026391267776,
0.01... | 0.160603 |
"/home/octocat/git/runner/\_layout/\_work", "targetVolumePath": "/\_\_w", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/externals", "targetVolumePath": "/\_\_e", "readOnly": true }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_temp", "targetVolumePath": "/\_\_w/\_temp", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_actions", "targetVolumePath": "/\_\_w/\_actions", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_tool", "targetVolumePath": "/\_\_w/\_tool", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_temp/\_github\_home", "targetVolumePath": "/github/home", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_temp/\_github\_workflow", "targetVolumePath": "/github/workflow", "readOnly": false } ], "registry": null, "portMappings": { "80": "801" } } } ``` #### Example input for Dockerfile If your container is defined by a Dockerfile, this example demonstrates how to specify the path to a `Dockerfile` in your input, using the `"dockerfile":` parameter. ```json copy { "command": "run\_container\_step", "responseFile": null, "state": { "network": "example\_network\_53269bd575972817b43f7733536b200c", "jobContainer": "82e8219701fe096a35941d869cf3d71af1d943b5d8bdd718857fb87ac3042480", "services": { "redis": "60972d9aa486605e66b0dad4abb678dc3d9116f536579e418176eedb8abb9105" } }, "args": { "image": null, "dockerfile": "/\_\_w/\_actions/foo/dockerfile", "entryPointArgs": ["hello world"], "entryPoint": "echo", "workingDirectory": "/\_\_w/octocat-test2/octocat-test2", "createOptions": "--cpus 1", "environmentVariables": { "NODE\_ENV": "development" }, "prependPath": ["/foo/bar", "bar/foo"], "userMountVolumes": [ { "sourceVolumePath": "my\_docker\_volume", "targetVolumePath": "/volume\_mount", "readOnly": false } ], "systemMountVolumes": [ { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work", "targetVolumePath": "/\_\_w", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/externals", "targetVolumePath": "/\_\_e", "readOnly": true }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_temp", "targetVolumePath": "/\_\_w/\_temp", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_actions", "targetVolumePath": "/\_\_w/\_actions", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_tool", "targetVolumePath": "/\_\_w/\_tool", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_temp/\_github\_home", "targetVolumePath": "/github/home", "readOnly": false }, { "sourceVolumePath": "/home/octocat/git/runner/\_layout/\_work/\_temp/\_github\_workflow", "targetVolumePath": "/github/workflow", "readOnly": false } ], "registry": null, "portMappings": { "80": "801" } } } ``` #### Example output for `run\_container\_step` No output is expected for `run\_container\_step`. ### `run\_script\_step` {% data variables.product.prodname\_actions %} assumes that you will do the following tasks: \* Invoke the provided script inside the job container and return the exit code. \* Stream any step log output to stdout and stderr. #### Arguments for `run\_script\_step` \* `entryPointArgs`: \*\*Optional\*\*. A list containing the entry point arguments. \* `entryPoint`: \*\*Optional\*\*. The container entry point to use if the default image entrypoint should be overwritten. \* `prependPath`: \*\*Optional\*\*. An array of additional paths to prepend to the `$PATH` variable. \* `workingDirectory`: \*\*Required\*\*. A string containing the absolute path of the working directory. \* `environmentVariables`: \*\*Optional\*\*. Sets a map of key environment variables. #### Example input for `run\_script\_step` ```json copy { "command": "run\_script\_step", "responseFile": null, "state": { "network": "example\_network\_53269bd575972817b43f7733536b200c", "jobContainer": "82e8219701fe096a35941d869cf3d71af1d943b5d8bdd718857fb87ac3042480", "serviceContainers": { "redis": "60972d9aa486605e66b0dad4abb678dc3d9116f536579e418176eedb8abb9105" } }, "args": { "entryPointArgs": ["-e", "/runner/temp/example.sh"], "entryPoint": "bash", "environmentVariables": { "NODE\_ENV": "development" }, "prependPath": ["/foo/bar", "bar/foo"], "workingDirectory": "/\_\_w/octocat-test2/octocat-test2" } } ``` #### Example output for `run\_script\_step` No output is expected for `run\_script\_step`. ## Generating the customization script {% data variables.product.prodname\_dotcom %} has created an example repository that demonstrates how to generate customization scripts for Docker and Kubernetes. > [!NOTE] > The resulting scripts are available for testing purposes, and you will need to determine whether they are appropriate for your requirements. 1. Clone the [actions/runner-container-hooks](https://github.com/actions/runner-container-hooks) repository to your self-hosted runner. 1. The `examples/` directory contains some existing customization commands, each with its own JSON file. You can review these examples and use them as a starting point for your own customization commands. \* `prepare\_job.json` \* `run\_script\_step.json` \* `run\_container\_step.json` 1. Build the npm packages. These commands generate the `index.js` files inside `packages/docker/dist` and `packages/k8s/dist`. ```shell npm install && npm run bootstrap && npm run build-all ``` When the resulting `index.js` is triggered by {% data variables.product.prodname\_actions %}, it will run the customization commands defined in the JSON files. To trigger the `index.js`, you will need to add it to your `ACTIONS\_RUNNER\_REQUIRE\_JOB\_CONTAINER` environment variable, as described in the next section. ## Triggering the customization script The custom script must be located on the runner, but should not be stored in the self-hosted runner application directory (that is, the directory into which you downloaded and unpacked the runner software). The scripts are executed in | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/customize-containers.md | main | github-actions | [
-0.029407331719994545,
-0.0333772674202919,
-0.03832487389445305,
0.06705189496278763,
0.023632487282156944,
-0.05493566021323204,
0.006507680751383305,
0.0385824590921402,
0.05914446711540222,
-0.023118266835808754,
0.027862662449479103,
-0.030165042728185654,
0.0117788165807724,
-0.01379... | 0.103251 |
variable, as described in the next section. ## Triggering the customization script The custom script must be located on the runner, but should not be stored in the self-hosted runner application directory (that is, the directory into which you downloaded and unpacked the runner software). The scripts are executed in the security context of the service account that's running the runner service. > [!NOTE] > The triggered script is processed synchronously, so it will block job execution while running. The script is automatically executed when the runner has the following environment variable containing an absolute path to the script: \* `ACTIONS\_RUNNER\_CONTAINER\_HOOKS`: The script defined in this environment variable is triggered when a job has been assigned to a runner, but before the job starts running. To set this environment variable, you can either add it to the operating system, or add it to a file named `.env` within the self-hosted runner application directory. For example, the following `.env` entry will have the runner automatically run the script at `/Users/octocat/runner/index.js` before each container-based job runs: ```bash ACTIONS\_RUNNER\_CONTAINER\_HOOKS=/Users/octocat/runner/index.js ``` If you want to ensure that your job always runs inside a container, and subsequently always applies your container customizations, you can set the `ACTIONS\_RUNNER\_REQUIRE\_JOB\_CONTAINER` variable on the self hosted runner to `true`. This will fail jobs that do not specify a job container. ## Troubleshooting ### No timeout setting There is currently no timeout setting available for the script executed by `ACTIONS\_RUNNER\_CONTAINER\_HOOKS`. As a result, you could consider adding timeout handling to your script. ### Reviewing the workflow run log To confirm whether your scripts are executing, you can review the logs for that job. For more information on checking the logs, see [AUTOTITLE](/actions/monitoring-and-troubleshooting-workflows/using-workflow-run-logs#viewing-logs-to-diagnose-failures). | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/customize-containers.md | main | github-actions | [
0.0158848874270916,
0.02640349604189396,
-0.03145504370331764,
0.041010499000549316,
0.024136994034051895,
-0.01364055834710598,
-0.013844138942658901,
0.013274425640702248,
-0.03887983784079552,
0.03183189034461975,
-0.05398028343915939,
-0.004950753413140774,
-0.023917565122246742,
-0.03... | 0.09996 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## Removing a runner from a repository > [!NOTE] > \* {% data reusables.actions.self-hosted-runner-removal-impact %} > \* {% data reusables.actions.self-hosted-runner-auto-removal %} > \* {% data reusables.actions.jit-runner-removal %} To remove a self-hosted runner from a user repository you must be the repository owner. Organization owners{% ifversion custom-org-roles %} and users with the "Manage organization runners and runner groups" permission{% endif %} can remove a runner from a repository in the organization. {% ifversion custom-org-roles %}For more information about custom organization roles, see [AUTOTITLE](/organizations/managing-peoples-access-to-your-organization-with-roles/about-custom-organization-roles).{% endif %} We recommend that you also have access to the self-hosted runner machine. For information about how to remove a self-hosted runner with the REST API, see [AUTOTITLE](/rest/actions/self-hosted-runners). {% data reusables.actions.self-hosted-runner-reusing %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.sidebar-settings %} {% data reusables.repositories.settings-sidebar-actions-runners %} {% data reusables.actions.settings-sidebar-actions-runner-selection %} {% data reusables.actions.self-hosted-runner-removing-a-runner-updated %} ## Removing a runner from an organization > [!NOTE] > \* {% data reusables.actions.self-hosted-runner-removal-impact %} > \* {% data reusables.actions.self-hosted-runner-auto-removal %} > \* {% data reusables.actions.jit-runner-removal %} To remove a self-hosted runner from an organization, you must be an organization owner{% ifversion custom-org-roles %} or have the "Manage organization runners and runner groups" permission{% endif %}. We recommend that you also have access to the self-hosted runner machine. For information about how to remove a self-hosted runner with the REST API, see [AUTOTITLE](/rest/actions/self-hosted-runners). {% ifversion custom-org-roles %}For more information about custom organization roles, see [AUTOTITLE](/organizations/managing-peoples-access-to-your-organization-with-roles/about-custom-organization-roles).{% endif %} {% data reusables.actions.self-hosted-runner-reusing %} {% data reusables.organizations.navigate-to-org %} {% data reusables.organizations.org\_settings %} {% data reusables.organizations.settings-sidebar-actions-runners %} {% data reusables.actions.settings-sidebar-actions-runner-selection %} {% data reusables.actions.self-hosted-runner-removing-a-runner-updated %} ## Removing a runner from an enterprise {% ifversion fpt %} If you use {% data variables.product.prodname\_ghe\_cloud %}, you can also remove runners from an enterprise. For more information, see the [{% data variables.product.prodname\_ghe\_cloud %} documentation](/enterprise-cloud@latest/actions/hosting-your-own-runners/managing-self-hosted-runners/removing-self-hosted-runners#removing-a-runner-from-an-enterprise). {% endif %} {% ifversion ghec or ghes %} > [!NOTE] > \* {% data reusables.actions.self-hosted-runner-removal-impact %} > \* {% data reusables.actions.self-hosted-runner-auto-removal %} > \* {% data reusables.actions.jit-runner-removal %} To remove a self-hosted runner from an enterprise, you must be an enterprise owner. We recommend that you also have access to the self-hosted runner machine. For information about how to remove a self-hosted runner with the REST API, see the enterprise endpoints in the [{% data variables.product.prodname\_actions %} REST API](/rest/actions/self-hosted-runners). {% data reusables.actions.self-hosted-runner-reusing %} {% data reusables.enterprise-accounts.access-enterprise %} {% data reusables.enterprise-accounts.policies-tab %} {% data reusables.enterprise-accounts.actions-tab %} {% data reusables.enterprise-accounts.actions-runners-tab %} {% data reusables.actions.settings-sidebar-actions-runner-selection %} {% data reusables.actions.self-hosted-runner-removing-a-runner-updated %} {% endif %} | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/self-hosted-runners/remove-runners.md | main | github-actions | [
-0.02310332842171192,
0.0498824417591095,
-0.020081521943211555,
0.054806943982839584,
0.02413451112806797,
-0.029620392248034477,
0.0015806038863956928,
-0.061734434217214584,
-0.010155493393540382,
0.012631298042833805,
0.043955665081739426,
0.03903577849268913,
0.02467607893049717,
0.00... | 0.102197 |
{% data reusables.actions.enterprise-github-hosted-runners %} If you require additional software packages on {% data variables.product.prodname\_dotcom %}-hosted runners, you can create a job that installs the packages as part of your workflow. To see which packages are already installed by default, see [AUTOTITLE](/actions/using-github-hosted-runners/about-github-hosted-runners#preinstalled-software). This guide demonstrates how to create a job that installs additional software on a {% data variables.product.prodname\_dotcom %}-hosted runner. ## Installing software on Ubuntu runners The following example demonstrates how to install an `apt` package as part of a job. ```yaml name: Build on Ubuntu on: push jobs: build: runs-on: ubuntu-latest steps: - name: Check out repository code uses: {% data reusables.actions.action-checkout %} - name: Install jq tool run: | sudo apt-get update sudo apt-get install jq ``` > [!NOTE] > Always run `sudo apt-get update` before installing a package. In case the `apt` index is stale, this command fetches and re-indexes any available packages, which helps prevent package installation failures. ## Installing software on macOS runners The following example demonstrates how to install Brew packages and casks as part of a job. ```yaml name: Build on macOS on: push jobs: build: runs-on: macos-latest steps: - name: Check out repository code uses: {% data reusables.actions.action-checkout %} - name: Install GitHub CLI run: | brew update brew install gh - name: Install Microsoft Edge run: | brew update brew install --cask microsoft-edge ``` ## Installing software on Windows runners The following example demonstrates how to use [Chocolatey](https://community.chocolatey.org/packages) to install the {% data variables.product.prodname\_dotcom %} CLI as part of a job. {% raw %} ```yaml name: Build on Windows on: push jobs: build: runs-on: windows-latest steps: - run: choco install gh - run: gh version ``` {% endraw %} | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/github-hosted-runners/customize-runners.md | main | github-actions | [
-0.05239120498299599,
-0.09391630440950394,
-0.030186010524630547,
-0.003522201906889677,
0.004114874172955751,
0.017780302092432976,
-0.01170984748750925,
0.018682893365621567,
-0.05044054985046387,
-0.016839291900396347,
0.01585165038704872,
0.04225406423211098,
-0.007451449986547232,
-0... | 0.094747 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## Viewing active jobs in your organization or enterprise You can get a list of all jobs currently running on {% data variables.product.prodname\_dotcom %}-hosted runners in your organization or enterprise. {% data reusables.actions.github-hosted-runners-navigate-to-repo-org-enterprise %} {% data reusables.actions.github-hosted-runners-table-entry %} 1. Review the "Active jobs" section, which contains a list of all jobs currently running on {% data variables.product.prodname\_dotcom %}-hosted runners. ## Viewing queued jobs in your organization or enterprise {% data variables.product.prodname\_dotcom %}-hosted runners allow you to run jobs concurrently, and the maximum number of concurrent jobs will vary depending on your plan. If you reach the maximum number of concurrent jobs, any new jobs will start to enter a queue. To find out more about the number of concurrent jobs available to your plan, see [AUTOTITLE](/actions/learn-github-actions/usage-limits-billing-and-administration). The following procedure demonstrates how to check the maximum number of concurrent jobs you can run. {% data reusables.actions.github-hosted-runners-navigate-to-repo-org-enterprise %} {% data reusables.actions.github-hosted-runners-table-entry %} 1. Review the "All jobs usage" section, which lists the number of active jobs and the maximum number of jobs you can run. | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/github-hosted-runners/view-current-jobs.md | main | github-actions | [
-0.03251437470316887,
-0.12564215064048767,
-0.10509536415338516,
0.062276411801576614,
0.039495326578617096,
-0.025693995878100395,
0.011733009479939938,
-0.03958805650472641,
-0.06855882704257965,
0.03850358724594116,
0.010799377225339413,
0.0801134705543518,
0.01319141499698162,
-0.0636... | 0.16322 |
{% ifversion ghes %} {% data reusables.actions.enterprise-github-hosted-runners %} {% else %} ## Using a {% data variables.product.prodname\_dotcom %}-hosted runner To use a {% data variables.product.prodname\_dotcom %}-hosted runner, create a job and use `runs-on` to specify the type of runner that will process the job, such as `ubuntu-latest`, `windows-latest`, or `macos-latest`. For the full list of runner types, see [AUTOTITLE](/actions/reference/github-hosted-runners-reference#supported-runners-and-hardware-resources).{% ifversion repository-actions-runners %} If you have `repo: write` access to a repository, you can view a list of the runners available to use in workflows in the repository. For more information, see [Viewing available runners for a repository](#viewing-available-runners-for-a-repository).{% endif %} When the job begins, {% data variables.product.prodname\_dotcom %} automatically provisions a new VM for that job. All steps in the job execute on the VM, allowing the steps in that job to share information using the runner's filesystem. You can run workflows directly on the VM or in a Docker container. When the job has finished, the VM is automatically decommissioned. The following diagram demonstrates how two jobs in a workflow are executed on two different {% data variables.product.prodname\_dotcom %}-hosted runners.  The following example workflow has two jobs, named `Run-npm-on-Ubuntu` and `Run-PSScriptAnalyzer-on-Windows`. When this workflow is triggered, {% data variables.product.prodname\_dotcom %} provisions a new virtual machine for each job. \* The job named `Run-npm-on-Ubuntu` is executed on a Linux VM, because the job's `runs-on:` specifies `ubuntu-latest`. \* The job named `Run-PSScriptAnalyzer-on-Windows` is executed on a Windows VM, because the job's `runs-on:` specifies `windows-latest`. ```yaml copy name: Run commands on different operating systems on: push: branches: [ main ] pull\_request: branches: [ main ] jobs: Run-npm-on-Ubuntu: name: Run npm on Ubuntu runs-on: ubuntu-latest steps: - uses: {% data reusables.actions.action-checkout %} - uses: {% data reusables.actions.action-setup-node %} with: node-version: '14' - run: npm help Run-PSScriptAnalyzer-on-Windows: name: Run PSScriptAnalyzer on Windows runs-on: windows-latest steps: - uses: {% data reusables.actions.action-checkout %} - name: Install PSScriptAnalyzer module shell: pwsh run: | Set-PSRepository PSGallery -InstallationPolicy Trusted Install-Module PSScriptAnalyzer -ErrorAction Stop - name: Get list of rules shell: pwsh run: | Get-ScriptAnalyzerRule ``` While the job runs, the logs and output can be viewed in the {% data variables.product.prodname\_dotcom %} UI:  {% data reusables.actions.runner-app-open-source %} {% ifversion repository-actions-runners %} ## Viewing available runners for a repository {% data reusables.actions.about-viewing-runner-list %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.repository-runners %} 1. Review the list of available GitHub-hosted runners for the repository. {% data reusables.actions.copy-runner-label %} {% data reusables.actions.actions-tab-new-runners-note %} {% endif %} {% endif %} | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/github-hosted-runners/use-github-hosted-runners.md | main | github-actions | [
-0.011719970963895321,
-0.050182044506073,
-0.07549808919429779,
0.03061189502477646,
0.05015356093645096,
0.002302001230418682,
-0.020812563598155975,
0.04552649334073067,
-0.06488040834665298,
0.0026718084700405598,
-0.011422115378081799,
0.01854548044502735,
-0.01978553831577301,
-0.024... | 0.133876 |
## Using WireGuard to create a network overlay {% data reusables.actions.private-networking-wireguard-intro %} There are various disadvantages to this approach: \* To reach WireGuard running on your private service, you will need a well-known IP address and port that your workflow can reference: this can either be a public IP address and port, a port mapping on a network gateway, or a service that dynamically updates DNS. \* WireGuard doesn't handle NAT traversal out of the box, so you'll need to identify a way to provide this service. \* This connection is one-to-one, so if you need high availability or high throughput you'll need to build that on top of WireGuard. \* You'll need to generate and securely store keys for both the runner and your private service. WireGuard uses UDP, so your network must support UDP traffic. There are some advantages too, as you can run WireGuard on an existing server so you don't have to maintain separate infrastructure, and it's well supported on {% data variables.product.prodname\_dotcom %}-hosted runners. ## Example: Configuring WireGuard This example workflow configures WireGuard to connect to a private service. For this example, the WireGuard instance running in the private network has this configuration: \* Overlay network IP address of `192.168.1.1` \* Public IP address and port of `1.2.3.4:56789` \* Public key `examplepubkey1234...` The WireGuard instance in the {% data variables.product.prodname\_actions %} runner has this configuration: \* Overlay network IP address of `192.168.1.2` \* Private key stores as an {% data variables.product.prodname\_actions %} secret under `WIREGUARD\_PRIVATE\_KEY` ```yaml name: WireGuard example on: workflow\_dispatch: jobs: wireguard\_example: runs-on: ubuntu-latest steps: - run: sudo apt install wireguard - run: echo {% raw %}"${{ secrets.WIREGUARD\_PRIVATE\_KEY }}"{% endraw %} > privatekey - run: sudo ip link add dev wg0 type wireguard - run: sudo ip address add dev wg0 192.168.1.2 peer 192.168.1.1 - run: sudo wg set wg0 listen-port 48123 private-key privatekey peer examplepubkey1234... allowed-ips 0.0.0.0/0 endpoint 1.2.3.4:56789 - run: sudo ip link set up dev wg0 - run: curl -vvv http://192.168.1.1 ``` For more information, see [WireGuard's Quick Start](https://www.wireguard.com/quickstart/), as well as [AUTOTITLE](/actions/security-guides/using-secrets-in-github-actions) for how to securely store keys. ### Using Tailscale to create a network overlay Tailscale is a commercial product built on top of WireGuard. This option is very similar to WireGuard, except Tailscale is more of a complete product experience instead of an open source component. Its disadvantages are similar to WireGuard: The connection is one-to-one, so you might need to do additional work for high availability or high throughput. You still need to generate and securely store keys. The protocol is still UDP, so your network must support UDP traffic. However, there are some advantages over WireGuard: NAT traversal is built-in, so you don't need to expose a port to the public internet. It is by far the quickest of these options to get up and running, since Tailscale provides an {% data variables.product.prodname\_actions %} workflow with a single step to connect to the overlay network. For more information, see the [Tailscale GitHub Action](https://github.com/tailscale/github-action), as well as [AUTOTITLE](/actions/security-guides/using-secrets-in-github-actions) for how to securely store keys. | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/github-hosted-runners/connect-to-a-private-network/connect-with-wireguard.md | main | github-actions | [
-0.13493239879608154,
0.024708179756999016,
-0.06339115649461746,
0.003090024460107088,
-0.027093909680843353,
0.015278236009180546,
0.06529318541288376,
0.07459461688995361,
-0.10598132759332657,
-0.01072700135409832,
0.006622400134801865,
0.02420603111386299,
0.027838990092277527,
-0.054... | 0.10078 |
## Using an API gateway with OIDC {% data reusables.actions.private-networking-oidc-intro %} For example, you could run an API gateway on the edge of your private network that authenticates incoming requests with the OIDC token and then makes API requests on behalf of your workflow in your private network. The following diagram gives an overview of this solution's architecture:  It's important that you verify not just that the OIDC token came from {% data variables.product.prodname\_actions %}, but that it came specifically from your expected workflows, so that other {% data variables.product.prodname\_actions %} users aren't able to access services in your private network. You can use OIDC claims to create these conditions. For more information, see [AUTOTITLE](/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#defining-trust-conditions-on-cloud-roles-using-oidc-claims). The main disadvantages of this approach are that you must implement the API gateway to make requests on your behalf, and you must run the gateway on the edge of your network. The following advantages apply. \* You don't need to configure any firewalls, or modify the routing of your private network. \* The API gateway is stateless and scales horizontally to handle high availability and high throughput. For more information, see [a reference implementation of an API Gateway](https://github.com/github/actions-oidc-gateway-example) in the github/actions-oidc-gateway repository. This implementation requires customization for your use case and is not ready-to-run as-is). For more information, see [AUTOTITLE](/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect). | https://github.com/github/docs/blob/main//content/actions/how-tos/manage-runners/github-hosted-runners/connect-to-a-private-network/connect-with-oidc.md | main | github-actions | [
-0.09762077033519745,
0.010317385196685791,
-0.06386829912662506,
0.018963899463415146,
-0.003781393636018038,
-0.012349122203886509,
0.05971617251634598,
0.0712621882557869,
0.016216006129980087,
-0.053839899599552155,
-0.02697952836751938,
0.03724271059036255,
0.008112427778542042,
-0.01... | 0.047802 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## Creating workflow templates This procedure demonstrates how to create a workflow template and metadata file. The metadata file describes how the workflow templates will be presented to users when they are creating a new workflow. 1. If it doesn't already exist, create a new repository named `.github` in your organization. 1. Create a directory named `workflow-templates`. 1. Create your new workflow file inside the `workflow-templates` directory. If you need to refer to a repository's default branch, you can use the `$default-branch` placeholder. When a workflow is created the placeholder will be automatically replaced with the name of the repository's default branch. {% ifversion ghes %} > [!NOTE] > The following values in the `runs-on` key are also treated as placeholders: > > \* `ubuntu-latest` is replaced with `[ self-hosted ]` > \* `windows-latest` is replaced with `[ self-hosted, windows ]` > \* `macos-latest` is replaced with `[ self-hosted, macOS ]` {% endif %} For example, this file named `octo-organization-ci.yml` demonstrates a basic workflow. ```yaml copy name: Octo Organization CI on: push: branches: [ $default-branch ] pull\_request: branches: [ $default-branch ] jobs: build: runs-on: ubuntu-latest steps: - uses: {% data reusables.actions.action-checkout %} - name: Run a one-line script run: echo Hello from Octo Organization ``` 1. Create a metadata file inside the `workflow-templates` directory. The metadata file must have the same name as the workflow file, but instead of the `.yml` extension, it must be appended with `.properties.json`. For example, this file named `octo-organization-ci.properties.json` contains the metadata for a workflow file named `octo-organization-ci.yml`: {% data reusables.actions.workflow-templates-metadata-example %} {% data reusables.actions.workflow-templates-metadata-keys %} 1. To add another workflow template, add your files to the same `workflow-templates` directory. ## Next steps \* For reference information about workflow templates, see [AUTOTITLE](/actions/reference/workflows-and-actions/reusing-workflow-configurations#workflow-templates). | https://github.com/github/docs/blob/main//content/actions/how-tos/reuse-automations/create-workflow-templates.md | main | github-actions | [
0.06331196427345276,
-0.04494486004114151,
-0.04959607496857643,
0.011443923227488995,
-0.0328032448887825,
0.002266602823510766,
-0.027084965258836746,
0.03425293415784836,
0.05050303041934967,
0.012748783454298973,
-0.04887405410408974,
-0.007238318212330341,
-0.014721604064106941,
-0.02... | 0.074831 |
> [!WARNING] > \* {% data reusables.actions.outside-collaborators-actions %} > \* {% data reusables.actions.scoped-token-note %} ## Sharing actions and workflows from your private repository 1. Store the action or reusable workflow in a private repository. For more information, see [AUTOTITLE](/repositories/creating-and-managing-repositories/about-repositories#about-repository-visibility). 1. On {% data variables.product.prodname\_dotcom %}, navigate to the main page of the private repository. 1. Under your repository name, click \*\*{% octicon "gear" aria-hidden="true" aria-label="gear" %} Settings\*\*. {% data reusables.repositories.settings-sidebar-actions-general %} 1. To grant access to other private repositories, in the \*\*Access\*\* section at the bottom of the page, select \*\*Accessible from repositories owned by 'USERNAME' user\*\*. 1. Click \*\*Save\*\* to apply the settings. ## Next steps To reuse your shared workflows, see [AUTOTITLE](/actions/using-workflows/reusing-workflows). | https://github.com/github/docs/blob/main//content/actions/how-tos/reuse-automations/share-across-private-repositories.md | main | github-actions | [
-0.08320038765668869,
-0.04021430388092995,
-0.062207501381635666,
0.034884270280599594,
0.015317081473767757,
0.07662631571292877,
0.1073792427778244,
-0.0015190041158348322,
-0.04468369111418724,
0.017732836306095123,
0.05669165775179863,
-0.017931798473000526,
0.023859230801463127,
-0.0... | 0.086568 |
## Overview If your organization is owned by an enterprise account, you can share actions and reusable workflows within your enterprise, without publishing them publicly, by allowing {% data variables.product.prodname\_actions %} workflows to access an internal or private repository that contains the action or reusable workflow. Any actions or reusable workflows stored in the internal or private repository can be used in workflows defined in other internal or private repositories owned by the same organization, or by any organization owned by the enterprise. Actions and reusable workflows stored in internal repositories cannot be used in public repositories and actions and reusable workflows stored in private repositories cannot be used in public or internal repositories. > [!WARNING] > \* {% data reusables.actions.outside-collaborators-actions %} > \* {% data reusables.actions.scoped-token-note %} ## Sharing actions and workflows with your enterprise 1. Store the action or reusable workflow in an internal or private repository. For more information, see [AUTOTITLE](/repositories/creating-and-managing-repositories/about-repositories). 1. Configure the repository to allow access to workflows in other internal or private repositories. For more information, see [AUTOTITLE](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#allowing-access-to-components-in-a-private-repository) and [AUTOTITLE](/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#allowing-access-to-components-in-an-internal-repository). ## Further reading \* [AUTOTITLE](/admin/overview/about-enterprise-accounts) \* [AUTOTITLE](/actions/using-workflows/reusing-workflows) | https://github.com/github/docs/blob/main//content/actions/how-tos/reuse-automations/share-with-your-enterprise.md | main | github-actions | [
-0.0653415396809578,
-0.0714145079255104,
-0.10385026782751083,
0.0005955437663942575,
0.016959629952907562,
0.05863440781831741,
0.06972675770521164,
-0.007645894773304462,
0.018844353035092354,
-0.0017958430107682943,
0.023173045367002487,
0.04098976403474808,
0.011082387529313564,
-0.00... | 0.158519 |
> [!WARNING] > \* {% data reusables.actions.outside-collaborators-actions %} > \* {% data reusables.actions.scoped-token-note %} ## Sharing actions and workflows with your organization 1. Store the action or reusable workflow in a private repository. For more information, see [AUTOTITLE](/repositories/creating-and-managing-repositories/about-repositories#about-repository-visibility). 1. On {% data variables.product.prodname\_dotcom %}, navigate to the main page of the private repository. 1. Under your repository name, click \*\*{% octicon "gear" aria-hidden="true" aria-label="gear" %} Settings\*\*. {% data reusables.repositories.settings-sidebar-actions-general %} 1. To grant access to other private repositories in the organization, in the \*\*Access\*\* section at the bottom of the page, select \*\*Accessible from repositories in the 'ORGANIZATION-NAME' organization\*\*. 1. Click \*\*Save\*\* to apply the settings. ## Next steps To learn how to reuse your shared workflows, see [AUTOTITLE](/actions/using-workflows/reusing-workflows). | https://github.com/github/docs/blob/main//content/actions/how-tos/reuse-automations/share-with-your-organization.md | main | github-actions | [
-0.07553040981292725,
-0.03503894433379173,
-0.07348974794149399,
0.04111946001648903,
0.011794153600931168,
0.08161908388137817,
0.10018360614776611,
-0.016601894050836563,
-0.04093972221016884,
0.02100147120654583,
0.047741908580064774,
-0.019579436630010605,
0.016407325863838196,
-0.045... | 0.111494 |
## Creating a reusable workflow Reusable workflows are YAML-formatted files, very similar to any other workflow file. As with other workflow files, you locate reusable workflows in the `.github/workflows` directory of a repository. Subdirectories of the `workflows` directory are not supported. {% ifversion ghec or ghes %}You can standardize deployments by creating a self-hosted runner group that can only execute a specific reusable workflow. For more information, see [AUTOTITLE](/actions/hosting-your-own-runners/managing-self-hosted-runners/managing-access-to-self-hosted-runners-using-groups).{% endif %} For a workflow to be reusable, the values for `on` must include `workflow\_call`: ```yaml on: workflow\_call: ``` ## Using inputs and secrets in a reusable workflow You can define inputs and secrets, which can be passed from the caller workflow and then used within the called workflow. There are three stages to using an input or a secret in a reusable workflow. 1. In the reusable workflow, use the `inputs` and `secrets` keywords to define inputs or secrets that will be passed from a caller workflow. {% raw %} ```yaml on: workflow\_call: inputs: config-path: required: true type: string secrets: personal\_access\_token: required: true ``` {% endraw %} For details of the syntax for defining inputs and secrets, see [`on.workflow\_call.inputs`](/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow\_callinputs) and [`on.workflow\_call.secrets`](/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow\_callsecrets). 1. In the reusable workflow, reference the input or secret that you defined in the `on` key in the previous step. > [!NOTE] > If the secrets are inherited by using `secrets: inherit` in the calling workflow, you can reference them even if they are not explicitly defined in the `on` key. For more information, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idsecretsinherit). {% raw %} ```yaml jobs: reusable\_workflow\_job: runs-on: ubuntu-latest steps: - uses: actions/labeler@v6 with: repo-token: ${{ secrets.personal\_access\_token }} configuration-path: ${{ inputs.config-path }} ``` {% endraw %} In the example above, `personal\_access\_token` is a secret that's defined at the repository or organization level. > [!WARNING] > Environment secrets cannot be passed from the caller workflow as `on.workflow\_call` does not support the `environment` keyword. If you include `environment` in the reusable workflow at the job level, the environment secret will be used, and not the secret passed from the caller workflow. For more information, see [AUTOTITLE](/actions/deployment/targeting-different-environments/managing-environments-for-deployment#environment-secrets) and [AUTOTITLE](/actions/writing-workflows/workflow-syntax-for-github-actions#onworkflow\_call). 1. Pass the input or secret from the caller workflow. {% data reusables.actions.pass-inputs-to-reusable-workflows %} ### Example reusable workflow This reusable workflow file named `workflow-B.yml` (we'll refer to this later in the [example caller workflow](#example-caller-workflow)) takes an input string and a secret from the caller workflow and uses them in an action. {% raw %} ```yaml copy name: Reusable workflow example on: workflow\_call: inputs: config-path: required: true type: string secrets: token: required: true jobs: triage: runs-on: ubuntu-latest steps: - uses: actions/labeler@v6 with: repo-token: ${{ secrets.token }} configuration-path: ${{ inputs.config-path }} ``` {% endraw %} ## Calling a reusable workflow You call a reusable workflow by using the `uses` keyword. Unlike when you are using actions within a workflow, you call reusable workflows directly within a job, and not from within job steps. [`jobs..uses`](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_iduses) You reference reusable workflow files using one of the following syntaxes: {% data reusables.actions.reusable-workflow-calling-syntax %} You can call multiple workflows, referencing each in a separate job. {% data reusables.actions.uses-keyword-example %} ### Example caller workflow This workflow file calls two workflow files. The second of these, `workflow-B.yml` (shown in the [example reusable workflow](#example-reusable-workflow)), is passed an input (`config-path`) and a secret (`token`). {% raw %} ```yaml copy name: Call a reusable workflow on: pull\_request: branches: - main jobs: call-workflow: uses: octo-org/example-repo/.github/workflows/workflow-A.yml@v1 call-workflow-passing-data: permissions: contents: read pull-requests: write uses: octo-org/example-repo/.github/workflows/workflow-B.yml@main with: config-path: .github/labeler.yml secrets: token: ${{ secrets.GITHUB\_TOKEN }} ``` {% endraw %} ## Passing inputs and secrets to a reusable workflow {% data reusables.actions.pass-inputs-to-reusable-workflows %} ## Using a matrix strategy with a reusable workflow Jobs using the | https://github.com/github/docs/blob/main//content/actions/how-tos/reuse-automations/reuse-workflows.md | main | github-actions | [
-0.023958666250109673,
-0.06659288704395294,
-0.03808062523603439,
0.046200599521398544,
0.023337846621870995,
-0.01668010838329792,
-0.037483274936676025,
-0.02489703707396984,
0.04125786945223808,
-0.05220052972435951,
-0.037457242608070374,
0.06600794941186905,
-0.0052337865345180035,
-... | 0.137945 |
main jobs: call-workflow: uses: octo-org/example-repo/.github/workflows/workflow-A.yml@v1 call-workflow-passing-data: permissions: contents: read pull-requests: write uses: octo-org/example-repo/.github/workflows/workflow-B.yml@main with: config-path: .github/labeler.yml secrets: token: ${{ secrets.GITHUB\_TOKEN }} ``` {% endraw %} ## Passing inputs and secrets to a reusable workflow {% data reusables.actions.pass-inputs-to-reusable-workflows %} ## Using a matrix strategy with a reusable workflow Jobs using the matrix strategy can call a reusable workflow. A matrix strategy lets you use variables in a single job definition to automatically create multiple job runs that are based on the combinations of the variables. For example, you can use a matrix strategy to pass different inputs to a reusable workflow. For more information about matrices, see [AUTOTITLE](/actions/using-jobs/using-a-matrix-for-your-jobs). This example job below calls a reusable workflow and references the matrix context by defining the variable `target` with the values `[dev, stage, prod]`. It will run three jobs, one for each value in the variable. {% raw %} ```yaml copy jobs: ReusableMatrixJobForDeployment: strategy: matrix: target: [dev, stage, prod] uses: octocat/octo-repo/.github/workflows/deployment.yml@main with: target: ${{ matrix.target }} ``` {% endraw %} ## Nesting reusable workflows You can connect a maximum of {% ifversion fpt or ghec %}ten levels of workflows - that is, the top-level caller workflow and up to nine levels of reusable workflows. For example: \_caller-workflow.yml\_ → \_called-workflow-1.yml\_ → \_called-workflow-2.yml\_ → \_called-workflow-3.yml\_ → ... → \_called-workflow-9.yml\_.{% else %}four levels of workflows - that is, the top-level caller workflow and up to three levels of reusable workflows. For example: \_caller-workflow.yml\_ → \_called-workflow-1.yml\_ → \_called-workflow-2.yml\_ → \_called-workflow-3.yml\_.{% endif %} Loops in the workflow tree are not permitted. > [!NOTE] Nested reusable workflows require all workflows in the chain to be accessible to the caller, and permissions can only be maintained or reduced—not elevated—throughout the chain. For more information, see [AUTOTITLE](/actions/reference/reusable-workflows-reference#access-and-permissions-for-nested-workflows). From within a reusable workflow you can call another reusable workflow. {% raw %} ```yaml copy name: Reusable workflow on: workflow\_call: jobs: call-another-reusable: uses: octo-org/example-repo/.github/workflows/another-reusable.yml@v1 ``` {% endraw %} ## Passing secrets to nested workflows You can use `jobs..secrets` in a calling workflow to pass named secrets to a directly called workflow. Alternatively, you can use `jobs..secrets.inherit` to pass all of the calling workflow's secrets to a directly called workflow. For more information, see the section [AUTOTITLE](/actions/using-workflows/reusing-workflows#passing-inputs-and-secrets-to-a-reusable-workflow) above, and the reference article [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idsecretsinherit). Secrets are only passed to directly called workflow, so in the workflow chain A > B > C, workflow C will only receive secrets from A if they have been passed from A to B, and then from B to C. In the following example, workflow A passes all of its secrets to workflow B, by using the `inherit` keyword, but workflow B only passes one secret to workflow C. Any of the other secrets passed to workflow B are not available to workflow C. {% raw %} ```yaml jobs: workflowA-calls-workflowB: uses: octo-org/example-repo/.github/workflows/B.yml@main secrets: inherit # pass all secrets ``` ```yaml jobs: workflowB-calls-workflowC: uses: different-org/example-repo/.github/workflows/C.yml@main secrets: repo-token: ${{ secrets.personal\_access\_token }} # pass just this secret ``` {% endraw %} ## Using outputs from a reusable workflow A reusable workflow may generate data that you want to use in the caller workflow. To use these outputs, you must specify them as the outputs of the reusable workflow. If a reusable workflow that sets an output is executed with a matrix strategy, the output will be the output set by the last successful completing reusable workflow of the matrix which actually sets a value. That means if the last successful completing reusable workflow sets an empty string for its output, and the second last successful completing reusable workflow sets an actual value for its output, the output will contain the value of the | https://github.com/github/docs/blob/main//content/actions/how-tos/reuse-automations/reuse-workflows.md | main | github-actions | [
-0.08692119270563126,
-0.04616818204522133,
-0.12070939689874649,
0.023711690679192543,
-0.026689039543271065,
-0.027855167165398598,
0.019510578364133835,
-0.02756447158753872,
-0.0018131451215595007,
-0.06946945935487747,
-0.000956604431848973,
0.04896943271160126,
-0.0023054522462189198,
... | 0.150662 |
completing reusable workflow of the matrix which actually sets a value. That means if the last successful completing reusable workflow sets an empty string for its output, and the second last successful completing reusable workflow sets an actual value for its output, the output will contain the value of the second last completing reusable workflow. The following reusable workflow has a single job containing two steps. In each of these steps we set a single word as the output: "hello" and "world." In the `outputs` section of the job, we map these step outputs to job outputs called: `output1` and `output2`. In the `on.workflow\_call.outputs` section we then define two outputs for the workflow itself, one called `firstword` which we map to `output1`, and one called `secondword` which we map to `output2`. The `value` must be set to the value of a job-level output within the called workflow. Step-level outputs must first be mapped to job-level outputs as shown below. For more information, see [AUTOTITLE](/actions/using-jobs/defining-outputs-for-jobs#overview) and [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow\_calloutputs). {% raw %} ```yaml copy name: Reusable workflow on: workflow\_call: # Map the workflow outputs to job outputs outputs: firstword: description: "The first output string" value: ${{ jobs.example\_job.outputs.output1 }} secondword: description: "The second output string" value: ${{ jobs.example\_job.outputs.output2 }} jobs: example\_job: name: Generate output runs-on: ubuntu-latest # Map the job outputs to step outputs outputs: output1: ${{ steps.step1.outputs.firstword }} output2: ${{ steps.step2.outputs.secondword }} steps: - id: step1 run: echo "firstword=hello" >> $GITHUB\_OUTPUT - id: step2 run: echo "secondword=world" >> $GITHUB\_OUTPUT ``` {% endraw %} We can now use the outputs in the caller workflow, in the same way you would use the outputs from a job within the same workflow. We reference the outputs using the names defined at the workflow level in the reusable workflow: `firstword` and `secondword`. In this workflow, `job1` calls the reusable workflow and `job2` prints the outputs from the reusable workflow ("hello world") to standard output in the workflow log. {% raw %} ```yaml copy name: Call a reusable workflow and use its outputs on: workflow\_dispatch: jobs: job1: uses: octo-org/example-repo/.github/workflows/called-workflow.yml@v1 job2: runs-on: ubuntu-latest needs: job1 steps: - run: echo ${{ needs.job1.outputs.firstword }} ${{ needs.job1.outputs.secondword }} ``` {% endraw %} For more information on using job outputs, see [AUTOTITLE](/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob\_idoutputs). If you want to share something other than a variable (e.g. a build artifact) between workflows, see [AUTOTITLE](/actions/using-workflows/storing-workflow-data-as-artifacts). ## Monitoring which workflows are being used {% ifversion fpt or ghes %} Organizations that use {% data variables.product.prodname\_ghe\_cloud %} can interact with the audit log via the {% data variables.product.github %} REST API to monitor which workflows are being used. For more information, see [the {% data variables.product.prodname\_ghe\_cloud %} documentation](/enterprise-cloud@latest/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/reviewing-the-audit-log-for-your-organization#using-the-audit-log-api). {% else %} You can use the {% data variables.product.prodname\_dotcom %} REST API to monitor how reusable workflows are being used. The `prepared\_workflow\_job` audit log action is triggered when a workflow job is started. Included in the data recorded are: \* `repo` - the organization/repository where the workflow job is located. For a job that calls another workflow, this is the organization/repository of the caller workflow. \* `@timestamp` - the date and time that the job was started, in Unix epoch format. \* `job\_name` - the name of the job that was run. \* `calling\_workflow\_refs` - an array of file paths for all the caller workflows involved in this workflow job. The items in the array are in the reverse order that they were called in. For example, in a chain of workflows A > B > C, when viewing the logs for a job in workflow C, the array would be `["octo-org/octo-repo/.github/workflows/B.yml", "octo-org/octo-repo/.github/workflows/A.yml"]`. \* `calling\_workflow\_shas` - an array of SHAs for | https://github.com/github/docs/blob/main//content/actions/how-tos/reuse-automations/reuse-workflows.md | main | github-actions | [
-0.07066026329994202,
-0.0008434628834947944,
-0.06731031090021133,
0.03461632877588272,
-0.07040014863014221,
0.009137541987001896,
0.0173567496240139,
-0.04965522885322571,
0.025387458503246307,
-0.05878107622265816,
0.009468463249504566,
-0.015076548792421818,
0.03665217384696007,
-0.05... | 0.053111 |
items in the array are in the reverse order that they were called in. For example, in a chain of workflows A > B > C, when viewing the logs for a job in workflow C, the array would be `["octo-org/octo-repo/.github/workflows/B.yml", "octo-org/octo-repo/.github/workflows/A.yml"]`. \* `calling\_workflow\_shas` - an array of SHAs for all the caller workflows involved in this workflow job. The array contains the same number of items, in the same order, as the `calling\_workflow\_refs` array. \* `job\_workflow\_ref` - the workflow file that was used, in the form `{owner}/{repo}/{path}/{filename}@{ref}`. For a job that calls another workflow, this identifies the called workflow. For more information, see [AUTOTITLE](/organizations/keeping-your-organization-secure/managing-security-settings-for-your-organization/reviewing-the-audit-log-for-your-organization#using-the-audit-log-api). > [!NOTE] > Audit data for `prepared\_workflow\_job` can only be viewed using the REST API. It is not visible in the {% data variables.product.prodname\_dotcom %} web interface, or included in JSON/CSV exported audit data. {% endif %} ## Next steps To find information on the intricacies of reusing workflows, see [AUTOTITLE](/actions/reference/reusable-workflows-reference). | https://github.com/github/docs/blob/main//content/actions/how-tos/reuse-automations/reuse-workflows.md | main | github-actions | [
-0.05158626288175583,
0.029446544125676155,
-0.05443808436393738,
-0.01735975407063961,
0.018682552501559258,
-0.06428039819002151,
0.058902449905872345,
-0.09219489246606827,
0.11931253969669342,
-0.05243297293782234,
-0.030754035338759422,
0.06639835238456726,
-0.014139250852167606,
-0.0... | 0.146874 |
When a job's `if` condition is evaluated, {% data variables.product.prodname\_actions %} logs the expression evaluation to help you understand the result. This is useful for debugging both why a job was skipped and why a job ran when you expected it to be skipped. ## Accessing expression logs 1. Navigate to the workflow run summary. 1. Click on the job. 1. Click \*\*{% octicon "gear" aria-label="The Gear icon" %}\*\*. 1. Select \*\*Download log archive\*\*. 1. Extract the ZIP file and open the `JOB-NAME/system.txt` file. ## Understanding the log output The system log shows the expression evaluation: ```text Evaluating: (success() && ((github.repository == 'octo-org/octo-repo-prod'))) Expanded: (true && (('my-username/octo-repo-prod' == 'octo-org/octo-repo-prod'))) Result: false ``` | Line | Description | |------|-------------| | \*\*Evaluating\*\* | The original `if` expression from your workflow file. | | \*\*Expanded\*\* | The expression with context values substituted. This shows you exactly what values were used at runtime. | | \*\*Result\*\* | The final evaluation result (`true` or `false`). | In this example, the expanded line reveals that `github.repository` was `'my-username/octo-repo-prod'` (not `'octo-org/octo-repo-prod'`), which caused the condition to evaluate to `false`. > [!NOTE] > Expression logs are only available for job-level `if` conditions. For step-level conditions, you can enable debug logging to see expression evaluation in the job logs. For more information, see [AUTOTITLE](/actions/how-tos/monitor-workflows/enable-debug-logging). | https://github.com/github/docs/blob/main//content/actions/how-tos/monitor-workflows/view-job-condition-logs.md | main | github-actions | [
-0.06470818817615509,
0.05326947197318077,
-0.0438695102930069,
0.04122171178460121,
0.07509277015924454,
-0.058573417365550995,
0.06378282606601715,
-0.04567693546414375,
0.025526592507958412,
-0.019998595118522644,
0.06403301656246185,
-0.027972960844635963,
0.01188557967543602,
-0.06986... | 0.061914 |
{% data reusables.actions.enterprise-github-hosted-runners %} You can see whether a workflow run is in progress or complete from the workflow run page. You must be logged in to a {% data variables.product.prodname\_dotcom %} account to view workflow run information, including for public repositories. For more information, see [AUTOTITLE](/get-started/learning-about-github/access-permissions-on-github). If the run is complete, you can see whether the result was a success, failure, canceled, or neutral. If the run failed, you can view and search the build logs to diagnose the failure and re-run the workflow. You can also view billable job execution minutes, or download logs and build artifacts. {% data variables.product.prodname\_actions %} use the Checks API to output statuses, results, and logs for a workflow. {% data variables.product.prodname\_dotcom %} creates a new check suite for each workflow run. The check suite contains a check run for each job in the workflow, and each job includes steps. {% data variables.product.prodname\_actions %} are run as a step in a workflow. For more information about the Checks API, see [AUTOTITLE](/rest/checks). {% data reusables.actions.invalid-workflow-files %} ## Viewing logs to diagnose failures If your workflow run fails, you can see which step caused the failure and review the failed step's build logs to troubleshoot. You can see the time it took for each step to run. You can also copy a permalink to a specific line in the log file to share with your team. {% data reusables.repositories.permissions-statement-read %} In addition to the steps configured in the workflow file, {% data variables.product.prodname\_dotcom %} adds two additional steps to each job to set up and complete the job's execution. These steps are logged in the workflow run with the names "Set up job" and "Complete job". For jobs run on {% data variables.product.prodname\_dotcom %}-hosted runners, "Set up job" records details of the runner image, and includes a link to the list of preinstalled tools that were present on the runner machine. {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} {% data reusables.repositories.view-run %} {% data reusables.repositories.navigate-to-job %} {% data reusables.repositories.view-failed-job-results %} {% data reusables.repositories.view-specific-line %} ## Searching logs You can search the build logs for a particular step. When you search logs, only expanded steps are included in the results. {% data reusables.repositories.permissions-statement-read %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} {% data reusables.repositories.view-run %} {% data reusables.repositories.navigate-to-job %} 1. In the upper-right corner of the log output, in the \*\*Search logs\*\* search box, type a search query. ## Downloading logs You can download the log files from your workflow run. You can also download a workflow's artifacts. For more information, see [AUTOTITLE](/actions/using-workflows/storing-workflow-data-as-artifacts). {% data reusables.repositories.permissions-statement-read %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} {% data reusables.repositories.view-run %} {% data reusables.repositories.navigate-to-job %} 1. In the upper right corner of the log, select the {% octicon "gear" aria-label="Show options" %} dropdown menu, then click \*\*Download log archive\*\*.  > [!NOTE] > When you download the log archive for a workflow that was partially re-run, the archive only includes the jobs that were re-run. To get a complete set of logs for jobs that were run from a workflow, you must download the log archives for the previous run attempts that ran the other jobs. ## Deleting logs You can delete the log files from your workflow runs through the {% data variables.product.prodname\_dotcom %} web interface or programmatically. {% data reusables.repositories.permissions-statement-write %} ### Deleting logs via the {% data variables.product.prodname\_dotcom %} web interface {% data reusables.repositories.navigate-to-repo | https://github.com/github/docs/blob/main//content/actions/how-tos/monitor-workflows/use-workflow-run-logs.md | main | github-actions | [
0.009843803010880947,
-0.051615696400403976,
-0.07648597657680511,
0.015005174092948437,
0.07551837712526321,
-0.04821666702628136,
-0.0011035094503313303,
-0.005191138479858637,
-0.003813548246398568,
-0.008109519258141518,
-0.027001885697245598,
0.02801322750747204,
-0.006000474561005831,
... | 0.103149 |
the previous run attempts that ran the other jobs. ## Deleting logs You can delete the log files from your workflow runs through the {% data variables.product.prodname\_dotcom %} web interface or programmatically. {% data reusables.repositories.permissions-statement-write %} ### Deleting logs via the {% data variables.product.prodname\_dotcom %} web interface {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} {% data reusables.repositories.view-run %} 1. In the upper-right corner, select the {% octicon "kebab-horizontal" aria-label="Show workflow options" %} dropdown menu, then click \*\*Delete all logs\*\*.  1. Review the confirmation prompt. After deleting logs, the \*\*Delete all logs\*\* button is removed to indicate that no log files remain in the workflow run. ### Deleting logs programmatically You can use the following script to automatically delete all logs for a workflow. This can be a useful way to clean up logs for multiple workflow runs. To run the example script below: 1. Copy the code example and save it to a file called `delete-logs.sh`. 1. Grant it the execute permission with `chmod +x delete-logs.sh`. 1. Run the following command, where `REPOSITORY\_NAME` is the name of your repository and `WORKFLOW\_NAME` is the file name of your workflow. ```shell copy ./delete-logs.sh REPOSITORY\_NAME WORKFLOW\_NAME ``` For example, to delete all of the logs in the `monalisa/octocat` repository for the `.github/workflows/ci.yaml` workflow, you would run `./delete-logs.sh monalisa/octocat ci.yaml`. #### Example script ```bash copy #!/usr/bin/env bash # Delete all logs for a given workflow # Usage: delete-logs.sh set -oe pipefail REPOSITORY=$1 WORKFLOW\_NAME=$2 # Validate arguments if [[ -z "$REPOSITORY" ]]; then echo "Repository is required" exit 1 fi if [[ -z "$WORKFLOW\_NAME" ]]; then echo "Workflow name is required" exit 1 fi echo "Getting all completed runs for workflow $WORKFLOW\_NAME in $REPOSITORY" RUNS=$( gh api \ -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "/repos/$REPOSITORY/actions/workflows/$WORKFLOW\_NAME/runs" \ --paginate \ --jq '.workflow\_runs[] | select(.conclusion != "") | .id' ) echo "Found $(echo "$RUNS" | wc -l) completed runs for workflow $WORKFLOW\_NAME" # Delete logs for each run for RUN in $RUNS; do echo "Deleting logs for run $RUN" gh api \ --silent \ --method DELETE \ -H "Accept: application/vnd.github+json" \ -H "X-GitHub-Api-Version: 2022-11-28" \ "/repos/$REPOSITORY/actions/runs/$RUN/logs" || echo "Failed to delete logs for run $RUN" # Sleep for 100ms to avoid rate limiting sleep 0.1 done ``` ## Viewing logs with {% data variables.product.prodname\_cli %} {% data reusables.cli.cli-learn-more %} To view the log for a specific job, use the `run view` subcommand. Replace `run-id` with the ID of run that you want to view logs for. {% data variables.product.prodname\_cli %} returns an interactive menu for you to choose a job from the run. If you don't specify `run-id`, {% data variables.product.prodname\_cli %} returns an interactive menu for you to choose a recent run, and then returns another interactive menu for you to choose a job from the run. ```shell gh run view RUN\_ID --log ``` You can also use the `--job` flag to specify a job ID. Replace `job-id` with the ID of the job that you want to view logs for. ```shell gh run view --job JOB\_ID --log ``` You can use `grep` to search the log. For example, this command will return all log entries that contain the word `error`. ```shell gh run view --job JOB\_ID --log | grep error ``` To filter the logs for any failed steps, use `--log-failed` instead of `--log`. ```shell gh run view --job JOB\_ID --log-failed ``` | https://github.com/github/docs/blob/main//content/actions/how-tos/monitor-workflows/use-workflow-run-logs.md | main | github-actions | [
-0.05164933577179909,
-0.03825691342353821,
-0.018943365663290024,
0.012184377759695053,
0.036283936351537704,
-0.050813641399145126,
0.029441500082612038,
-0.09014110267162323,
-0.04772801697254181,
0.0018331902101635933,
-0.010523702017962933,
0.022483723238110542,
-0.025896945968270302,
... | 0.078584 |
that contain the word `error`. ```shell gh run view --job JOB\_ID --log | grep error ``` To filter the logs for any failed steps, use `--log-failed` instead of `--log`. ```shell gh run view --job JOB\_ID --log-failed ``` | https://github.com/github/docs/blob/main//content/actions/how-tos/monitor-workflows/use-workflow-run-logs.md | main | github-actions | [
0.0054609584622085094,
0.0162068922072649,
-0.01066685002297163,
-0.02564830891788006,
0.06263282895088196,
-0.026769287884235382,
0.04493572935461998,
-0.025168118998408318,
-0.05043179169297218,
0.0021262196823954582,
0.002030008239671588,
-0.10416229814291,
0.01935097761452198,
0.023033... | -0.008622 |
{% data reusables.actions.enterprise-github-hosted-runners %} > [!NOTE] > Workflow badges in a private repository are not accessible externally, so you won't be able to embed them or link to them from an external site. {% data reusables.repositories.actions-workflow-status-badge-intro %} To add a workflow status badge to your `README.md` file, first find the URL for the status badge you would like to display. Then you can use Markdown to display the badge as an image in your `README.md` file. For more information about image markup in Markdown, see [AUTOTITLE](/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#images). ## Using the UI You can create a workflow status badge directly on the UI using the workflow file name, branch parameter, and event parameter. {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} 1. On the right side of the page, next to the "Filter workflow runs" field, click {% octicon "kebab-horizontal" aria-label="Show workflow options" %} to display a dropdown menu and click \*\*Create status badge\*\*. 1. Optionally, select a branch if you want to display the status badge for a branch different from the default branch. 1. Optionally, select the event that will trigger the workflow. 1. Click \*\*{% octicon "copy" aria-hidden="true" aria-label="copy" %} Copy status badge Markdown\*\*. 1. Copy the Markdown into your `README.md` file. ## Using the workflow file name You can build the URL for a workflow status badge using the name of the workflow file: ```text {% ifversion fpt or ghec %}https://github.com{% else %}HOSTNAME{% endif %}/OWNER/REPOSITORY/actions/workflows/WORKFLOW-FILE/badge.svg ``` To display the workflow status badge in your `README.md` file, use the Markdown markup for embedding images. For more information about image markup in Markdown, see [AUTOTITLE](/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#images). For example, add the following Markdown to your `README.md` file to add a status badge for a workflow with the file path `.github/workflows/main.yml`. The `OWNER` of the repository is the `github` organization and the `REPOSITORY` name is `docs`. ```markdown  ``` ## Using the `branch` parameter To display the status of a workflow run for a specific branch, add `?branch=BRANCH-NAME` to the end of the status badge URL. For example, add the following Markdown to your `README.md` file to display a status badge for a branch with the name `feature-1`. ```markdown  ``` ## Using the `event` parameter To display the status of workflow runs triggered by the `push` event, add `?event=push` to the end of the status badge URL. For example, add the following Markdown to your `README.md` file to display a badge with the status of workflow runs triggered by the `push` event, which will show the status of the build for the current state of that branch. ```markdown  ``` | https://github.com/github/docs/blob/main//content/actions/how-tos/monitor-workflows/add-a-status-badge.md | main | github-actions | [
-0.038791634142398834,
0.04138527065515518,
-0.06451122462749481,
0.060423582792282104,
0.05482937768101692,
0.04449174553155899,
-0.03722885251045227,
0.031102914363145828,
-0.0072602033615112305,
-0.015519795939326286,
-0.04886813834309578,
0.08789531886577606,
0.07854153215885162,
-0.00... | 0.077376 |
{% data reusables.actions.enterprise-github-hosted-runners %} Billable job execution minutes are only shown for jobs run on private repositories that use {% data variables.product.prodname\_dotcom %}-hosted runners and are rounded up to the next minute. There are no billable minutes when using {% data variables.product.prodname\_actions %} in public repositories or for jobs run on self-hosted runners. {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} {% data reusables.repositories.view-run %} 1. Under the job summary, you can view the job's execution time. 1. To view details about the billable job execution time, in the left sidebar under "Run details", click \*\*{% octicon "stopwatch" aria-hidden="true" aria-label="stopwatch" %} Usage\*\*. > [!NOTE] > The billable time shown does not include any minute multipliers. To view your total {% data variables.product.prodname\_actions %} usage, including minute multipliers, see [AUTOTITLE](/billing/managing-billing-for-github-actions/viewing-your-github-actions-usage). | https://github.com/github/docs/blob/main//content/actions/how-tos/monitor-workflows/view-job-execution-time.md | main | github-actions | [
-0.0072166575118899345,
-0.017827069386839867,
-0.07293672859668732,
0.07877255231142044,
0.032708872109651566,
-0.005640807095915079,
-0.020278511568903923,
-0.00032377225579693913,
-0.013081610202789307,
0.019869262352585793,
0.008265739306807518,
0.005480313673615456,
-0.04140772670507431... | 0.078786 |
{% data reusables.actions.enterprise-github-hosted-runners %} These extra logs are enabled by setting secrets or variables in the repository containing the workflow, so the same permissions requirements will apply: \* {% data reusables.actions.permissions-statement-secrets-variables-repository %} \* {% data reusables.actions.permissions-statement-secrets-environment %} \* {% data reusables.actions.permissions-statement-secrets-and-variables-organization %} For more information on setting secrets and variables, see [AUTOTITLE](/actions/security-guides/using-secrets-in-github-actions) and [AUTOTITLE](/actions/learn-github-actions/variables). Additionally, anyone who has access to run a workflow can enable runner diagnostic logging and step debug logging for a workflow re-run. For more information, see [AUTOTITLE](/actions/managing-workflow-runs/re-running-workflows-and-jobs). ## Enabling runner diagnostic logging Runner diagnostic logging provides additional log files that contain information about how a runner is executing a job. Two extra log files are added to the log archive: \* The runner process log, which includes information about coordinating and setting up runners to execute jobs. \* The worker process log, which logs the execution of a job. 1. To enable runner diagnostic logging, set the following secret or variable in the repository that contains the workflow: `ACTIONS\_RUNNER\_DEBUG` to `true`. If both the secret and variable are set, the value of the secret takes precedence over the variable. 1. To download runner diagnostic logs, download the log archive of the workflow run. The runner diagnostic logs are contained in the `runner-diagnostic-logs` folder. For more information on downloading logs, see [AUTOTITLE](/actions/monitoring-and-troubleshooting-workflows/using-workflow-run-logs#downloading-logs). ## Enabling step debug logging Step debug logging increases the verbosity of a job's logs during and after a job's execution. 1. To enable step debug logging, set the following secret or variable in the repository that contains the workflow: `ACTIONS\_STEP\_DEBUG` to `true`. If both the secret and variable are set, the value of the secret takes precedence over the variable. 1. After setting the secret or variable, more debug events are shown in the step logs. For more information, see [AUTOTITLE](/actions/monitoring-and-troubleshooting-workflows/using-workflow-run-logs#viewing-logs-to-diagnose-failures). You can also use the `runner.debug` context to conditionally run steps only when debug logging is enabled. For more information, see [AUTOTITLE](/actions/reference/workflows-and-actions/contexts#runner-context). | https://github.com/github/docs/blob/main//content/actions/how-tos/monitor-workflows/enable-debug-logging.md | main | github-actions | [
-0.001528189517557621,
-0.04393333941698074,
-0.05854716897010803,
0.062391024082899094,
0.055762551724910736,
-0.015715792775154114,
0.011196833103895187,
-0.03600405901670456,
-0.025064796209335327,
-0.004675221163779497,
0.0034058631863445044,
0.04022097960114479,
0.002150741871446371,
... | 0.127071 |
{% data reusables.actions.enterprise-github-hosted-runners %} {% data reusables.repositories.permissions-statement-read %} {% webui %} {% data reusables.repositories.navigate-to-repo %} {% data reusables.repositories.actions-tab %} {% data reusables.repositories.navigate-to-workflow %} {% data reusables.repositories.view-run %} {% endwebui %} {% cli %} {% data reusables.cli.cli-learn-more %} ## Viewing recent workflow runs To list the recent workflow runs, use the `run list` subcommand. ```shell gh run list ``` To specify the maximum number of runs to return, you can use the `-L` or `--limit` flag . The default is `10`. ```shell gh run list --limit 5 ``` To only return runs for the specified workflow, you can use the `-w` or `--workflow` flag. Replace `workflow` with either the workflow name, workflow ID, or workflow file name. For example, `"Link Checker"`, `1234567`, or `"link-check-test.yml"`. ```shell gh run list --workflow WORKFLOW ``` ## Viewing details for a specific workflow run To display details for a specific workflow run, use the `run view` subcommand. Replace `run-id` with the ID of the run that you want to view. If you don't specify a `run-id`, {% data variables.product.prodname\_cli %} returns an interactive menu for you to choose a recent run. ```shell gh run view RUN\_ID ``` To include job steps in the output, use the `-v` or `--verbose` flag. ```shell gh run view RUN\_ID --verbose ``` To view details for a specific job in the run, use the `-j` or `--job` flag. Replace `job-id` with the ID of the job that you want to view. ```shell gh run view --job JOB\_ID ``` To view the full log for a job, use the `--log` flag. ```shell gh run view --job JOB\_ID --log ``` Use the `--exit-status` flag to exit with a non-zero status if the run failed. For example: ```shell gh run view 0451 --exit-status && echo "run pending or passed" ``` {% endcli %} | https://github.com/github/docs/blob/main//content/actions/how-tos/monitor-workflows/view-workflow-run-history.md | main | github-actions | [
0.008608276955783367,
-0.06784946471452713,
-0.04253440350294113,
0.027856409549713135,
0.024045350030064583,
-0.048788320273160934,
0.022391820326447487,
-0.030481429770588875,
-0.05361390858888626,
-0.006653566844761372,
-0.00373975932598114,
0.02642633579671383,
0.010924657806754112,
-0... | 0.057815 |
{% data reusables.actions.enterprise-github-hosted-runners %} ## Introduction After you create an action, you'll want to continue releasing new features while working with community contributions. This tutorial describes an example process you can follow to release and maintain actions in open source. The example: \* Leverages {% data variables.product.prodname\_actions %} for continuous integration, dependency updates, release management, and task automation. \* Provides confidence through automated tests and build badges. \* Indicates how the action can be used, ideally as part of a broader workflow. \* Signal what type of community contributions you welcome. (For example, issues, pull requests, or vulnerability reports.) For an applied example of this process, see [actions/javascript-action](https://github.com/actions/javascript-action). ## Developing and releasing actions In this section, we discuss an example process for developing and releasing actions and show how to use {% data variables.product.prodname\_actions %} to automate the process. ### About JavaScript actions JavaScript actions are Node.js repositories with metadata. However, JavaScript actions have additional properties compared to traditional Node.js projects: \* Dependent packages are committed alongside the code, typically in a compiled and minified form. This means that automated builds and secure community contributions are important. {% ifversion fpt or ghec %} \* Tagged releases can be published directly to {% data variables.product.prodname\_marketplace %} and consumed by workflows across {% data variables.product.prodname\_dotcom %}. {% endif %} \* Many actions make use of {% data variables.product.prodname\_dotcom %}'s APIs and third party APIs, so we encourage robust end-to-end testing. ### Setting up {% data variables.product.prodname\_actions %} workflows To support the developer process in the next section, add two {% data variables.product.prodname\_actions %} workflows to your repository: 1. Add a workflow that triggers when a commit is pushed to a feature branch or to `main` or when a pull request is created. Configure the workflow to run your unit and integration tests. For an example, see [this workflow](https://github.com/actions/javascript-action/blob/main/.github/workflows/ci.yml). 1. Add a workflow that triggers when a release is published or edited. Configure the workflow to ensure semantic tags are in place. You can use an action like [JasonEtco/build-and-tag-action](https://github.com/JasonEtco/build-and-tag-action) to compile and bundle the JavaScript and metadata file and force push semantic major, minor, and patch tags. For more information about semantic tags, see [About semantic versioning](https://docs.npmjs.com/about-semantic-versioning). {% ifversion fpt or ghec %} > [!NOTE] > If you enable immutable releases for your repository, you cannot use this action to force push tags tied to releases on {% data variables.product.github %}. To learn how to manage your releases with immutable releases, see [AUTOTITLE](/actions/how-tos/create-and-publish-actions/using-immutable-releases-and-tags-to-manage-your-actions-releases). {% endif %} ### Example developer process Here is an example process that you can follow to automatically run tests, create a release{% ifversion fpt or ghec %} and publish to {% data variables.product.prodname\_marketplace %}{% endif %}, and publish your action. 1. Do feature work in branches per GitHub flow. For more information, see [AUTOTITLE](/get-started/using-github/github-flow). \* Whenever a commit is pushed to the feature branch, your testing workflow will automatically run the tests. 1. Create pull requests to the `main` branch to initiate discussion and review, merging when ready. \* When a pull request is opened, either from a branch or a fork, your testing workflow will again run the tests, this time with the merge commit. \* \*\*Note:\*\* for security reasons, workflows triggered by `pull\_request` from forks have restricted `GITHUB\_TOKEN` permissions and do not have access to secrets. If your tests or other workflows triggered upon pull request require access to secrets, consider using a different event like a [manual trigger](/actions/using-workflows/events-that-trigger-workflows#manual-events) or a [`pull\_request\_target`](/actions/using-workflows/events-that-trigger-workflows#pull\_request\_target). For more information, see [AUTOTITLE](/actions/using-workflows/events-that-trigger-workflows#pull-request-events-for-forked-repositories). 1. Create a semantically tagged release. {% ifversion fpt or ghec %} You may also publish to {% data variables.product.prodname\_marketplace | https://github.com/github/docs/blob/main//content/actions/how-tos/create-and-publish-actions/release-and-maintain-actions.md | main | github-actions | [
-0.0677424743771553,
-0.06647808849811554,
-0.06722849607467651,
0.04305952042341232,
0.05840503051877022,
0.027025798335671425,
0.032709747552871704,
0.08838936686515808,
-0.056071896106004715,
0.017151663079857826,
0.03861808031797409,
0.02314373292028904,
-0.002500203438103199,
-0.02425... | 0.176007 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.