Skip to content

Commit e568736

Browse files
authored
Merge pull request #12600 from github/repo-sync
repo sync
2 parents 5f207bd + 8942826 commit e568736

32 files changed

Lines changed: 799 additions & 608 deletions

.github/workflows/triage-stale-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name: Public Repo Stale Check
77
on:
88
schedule:
99
- cron: '45 16 * * *' # Run each day at 16:45 UTC / 8:45 PST
10-
10+
1111
permissions:
1212
issues: write
1313
pull-requests: write

content/github-cli/github-cli/creating-github-cli-extensions.md

Lines changed: 141 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,21 @@ topics:
1414

1515
{% data reusables.cli.cli-extensions %} For more information about how to use {% data variables.product.prodname_cli %} extensions, see "[Using {% data variables.product.prodname_cli %} extensions](/github-cli/github-cli/using-github-cli-extensions)."
1616

17-
You need a repository for each extension that you create. The repository name must start with `gh-`. The rest of the repository name is the name of the extension. At the root of the repository, there must be an executable file with the same name as the repository. This file will be executed when the extension is invoked.
17+
You need a repository for each extension that you create. The repository name must start with `gh-`. The rest of the repository name is the name of the extension. The repository must have an executable file at its root with the same name as the repository or a set of precompiled binary executables attached to a release.
1818

1919
{% note %}
2020

21-
**Note**: We recommend that the executable file is a bash script because bash is a widely available interpreter. You may use non-bash scripts, but the user must have the necessary interpreter installed in order to use the extension.
21+
**Note**: When relying on an executable script, we recommend using a bash script because bash is a widely available interpreter. You may use non-bash scripts, but the user must have the necessary interpreter installed in order to use the extension. If you would prefer to not rely on users having interpreters installed, consider a precompiled extension.
2222

2323
{% endnote %}
2424

25-
## Creating an extension with `gh extension create`
25+
## Creating an interpreted extension with `gh extension create`
26+
27+
{% note %}
28+
29+
**Note**: Running `gh extension create` with no arguments will start an interactive wizard.
30+
31+
{% endnote %}
2632

2733
You can use the `gh extension create` command to create a project for your extension, including a bash script that contains some starter code.
2834

@@ -34,7 +40,35 @@ You can use the `gh extension create` command to create a project for your exten
3440

3541
1. Follow the printed instructions to finalize and optionally publish your extension.
3642

37-
## Creating an extension manually
43+
## Creating a precompiled extension in Go with `gh extension create`
44+
45+
You can use the `--precompiled=go` argument to create a Go-based project for your extension, including Go scaffolding, workflow scaffolding, and starter code.
46+
47+
1. Set up a new extension by using the `gh extension create` subcommand. Replace `EXTENSION-NAME` with the name of your extension and specify `--precompiled=go`.
48+
49+
```shell
50+
gh extension create --precompiled=go <em>EXTENSION-NAME</em>
51+
```
52+
53+
1. Follow the printed instructions to finalize and optionally publish your extension.
54+
55+
## Creating a non-Go precompiled extension with `gh extension create`
56+
57+
You can use the `--precompiled=other` argument to create a project for your non-Go precompiled extension, including workflow scaffolding.
58+
59+
1. Set up a new extension by using the `gh extension create` subcommand. Replace `EXTENSION-NAME` with the name of your extension and specify `--precompiled=other`.
60+
61+
```shell
62+
gh extension create --precompiled=other <em>EXTENSION-NAME</em>
63+
```
64+
65+
1. Add some initial code for your extension in your compiled language of choice.
66+
67+
1. Fill in `script/build.sh` with code to build your extension to ensure that your extension can be built automatically.
68+
69+
1. Follow the printed instructions to finalize and optionally publish your extension.
70+
71+
## Creating an interpreted extension manually
3872

3973
1. Create a local directory called `gh-EXTENSION-NAME` for your extension. Replace `EXTENSION-NAME` with the name of your extension. For example, `gh-whoami`.
4074

@@ -56,7 +90,7 @@ You can use the `gh extension create` command to create a project for your exten
5690

5791
1. From your directory, install the extension as a local extension.
5892

59-
```bash
93+
```shell
6094
gh extension install .
6195
```
6296

@@ -70,13 +104,13 @@ You can use the `gh extension create` command to create a project for your exten
70104

71105
```shell
72106
git init -b main
73-
git add . && git commit -m "initial commit"
74-
gh repo create gh-<em>EXTENSION-NAME</em> --source=. --public --push
107+
git add . && git commit -m "initial commit"
108+
gh repo create gh-<em>EXTENSION-NAME</em> --source=. --public --push
75109
```
76110

77111
1. Optionally, to help other users discover your extension, add the repository topic `gh-extension`. This will make the extension appear on the [`gh-extension` topic page](https://github.com/topics/gh-extension). For more information about how to add a repository topic, see "[Classifying your repository with topics](/github/administering-a-repository/managing-repository-settings/classifying-your-repository-with-topics)."
78112

79-
## Tips for writing {% data variables.product.prodname_cli %} extensions
113+
## Tips for writing interpreted {% data variables.product.prodname_cli %} extensions
80114

81115
### Handling arguments and flags
82116

@@ -120,34 +154,128 @@ fi
120154

121155
### Calling core commands in non-interactive mode
122156

123-
Some {% data variables.product.prodname_cli %} core commands will prompt the user for input. When scripting with those commands, a prompt is often undesirable. To avoid prompting, supply the necessary information explicitly via arguments.
157+
Some {% data variables.product.prodname_cli %} core commands will prompt the user for input. When scripting with those commands, a prompt is often undesirable. To avoid prompting, supply the necessary information explicitly via arguments.
124158

125159
For example, to create an issue programmatically, specify the title and body:
126160

127-
```bash
161+
```shell
128162
gh issue create --title "My Title" --body "Issue description"
129163
```
130164

131165
### Fetching data programatically
132166

133167
Many core commands support the `--json` flag for fetching data programatically. For example, to return a JSON object listing the number, title, and mergeability status of pull requests:
134-
```bash
168+
169+
```shell
135170
gh pr list --json number,title,mergeStateStatus
136171
```
137172

138173
If there is not a core command to fetch specific data from GitHub, you can use the [`gh api`](https://cli.github.com/manual/gh_api) command to access the GitHub API. For example, to fetch information about the current user:
139-
```bash
174+
175+
```shell
140176
gh api user
141177
```
142178

143179
All commands that output JSON data also have options to filter that data into something more immediately usable by scripts. For example, to get the current user's name:
144180
145-
```bash
181+
```shell
146182
gh api user --jq '.name'
147183
```
148184
149185
For more information, see [`gh help formatting`](https://cli.github.com/manual/gh_help_formatting).
150186
187+
## Creating a precompiled extension manually
188+
189+
1. Create a local directory called `gh-EXTENSION-NAME` for your extension. Replace `EXTENSION-NAME` with the name of your extension. For example, `gh-whoami`.
190+
191+
1. In the directory you created, add some source code. For example:
192+
193+
```go
194+
package main
195+
import (
196+
"github.com/cli/go-gh"
197+
"fmt"
198+
)
199+
200+
func main() {
201+
args := []string{"api", "user", "--jq", `"You are @\(.login) (\(.name))"` }
202+
stdOut, _, err := gh.Exec(args...)
203+
if err != nil {
204+
fmt.Println(err)
205+
return
206+
}
207+
fmt.Println(stdOut.String())
208+
}
209+
```
210+
211+
1. From your directory, install the extension as a local extension.
212+
213+
```shell
214+
gh extension install .
215+
```
216+
217+
1. Build your code. For example, with Go, replacing `YOUR-USERNAME` with your GitHub username:
218+
219+
```shell
220+
go mod init github.com/<em>YOUR-USERNAME</em>/gh-whoami
221+
go mod tidy
222+
go build
223+
```
224+
225+
1. Verify that your extension works. Replace `EXTENSION-NAME` with the name of your extension. For example, `whoami`.
226+
227+
```shell
228+
gh <em>EXTENSION-NAME</em>
229+
```
230+
231+
1. From your directory, create a repository to publish your extension. Replace `EXTENSION-NAME` with the name of your extension.
232+
233+
{% note %}
234+
235+
**Note:** Be careful not to commit the binary produced by your compilation step to version control.
236+
237+
{% endnote %}
238+
239+
```shell
240+
git init -b main
241+
echo "gh-<em>EXTENSION-NAME</em>" >> .gitignore
242+
git add main.go go.* .gitignore && git commit -m'Initial commit'
243+
gh repo create "gh-<em>EXTENSION-NAME</em>"
244+
```
245+
246+
1. Create a release to share your precompiled extension with others. Compile for each platform you want to support, attaching each binary to a release as an asset. Binary executables attached to releases must follow a naming convention and have a suffix of <em>OS-ARCHITECTURE\[EXTENSION\]</em>.
247+
248+
For example, an extension named `whoami` compiled for Windows 64bit would have the name `gh-whoami-windows-amd64.exe` while the same extension compiled for Linux 32bit would have the name `gh-whoami-linux-386`. To see an exhaustive list of OS and architecture combinations recognized by `gh`, see [this source code](https://github.com/cli/cli/blob/14f704fd0da58cc01413ee4ba16f13f27e33d15e/pkg/cmd/extension/manager.go#L696).
249+
250+
{% note %}
251+
252+
**Note:** For your extension to run properly on Windows, its asset file must have a `.exe` extension. No extension is needed for other operating systems.
253+
254+
{% endnote %}
255+
256+
Releases can be created from the command line. For example:
257+
258+
```shell
259+
git tag v1.0.0
260+
git push origin v1.0.0
261+
GOOS=windows GOARCH=amd64 go build -o gh-<em>EXTENSION-NAME</em>-windows-amd64.exe
262+
GOOS=linux GOARCH=amd64 go build -o gh-<em>EXTENSION-NAME</em>-linux-amd64
263+
GOOS=darwin GOARCH=amd64 go build -o gh-<em>EXTENSION-NAME</em>-darwin-amd64
264+
gh release create v1.0.0 ./*amd64*
265+
266+
1. Optionally, to help other users discover your extension, add the repository topic `gh-extension`. This will make the extension appear on the [`gh-extension` topic page](https://github.com/topics/gh-extension). For more information about how to add a repository topic, see "[Classifying your repository with topics](/github/administering-a-repository/managing-repository-settings/classifying-your-repository-with-topics)."
267+
268+
269+
## Tips for writing precompiled {% data variables.product.prodname_cli %} extensions
270+
271+
### Automating releases
272+
273+
Consider adding the [gh-extension-precompile](https://github.com/cli/gh-extension-precompile) action to a workflow in your project. This action will automatically produce cross-compiled Go binaries for your extension and supplies build scaffolding for non-Go precompiled extensions.
274+
275+
### Using {% data variables.product.prodname_cli %} features from Go-based extensions
276+
277+
Consider using [go-gh](https://github.com/cli/go-gh), a Go library that exposes pieces of `gh` functionality for use in extensions.
278+
151279
## Next steps
152280
153281
To see more examples of {% data variables.product.prodname_cli %} extensions, look at [repositories with the `gh-extension` topic](https://github.com/topics/gh-extension).

translations/es-ES/content/actions/creating-actions/releasing-and-maintaining-actions.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ topics:
99
- Community
1010
versions:
1111
fpt: '*'
12+
ghec: '*'
1213
ghes: '*'
1314
ghae: '*'
1415
---
@@ -37,7 +38,7 @@ JavaScript actions are Node.js repositories with metadata. However, JavaScript a
3738

3839
* 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.
3940

40-
{% ifversion fpt %}
41+
{% ifversion fpt or ghec %}
4142

4243
* Tagged releases can be published directly to {% data variables.product.prodname_marketplace %} and consumed by workflows across {% data variables.product.prodname_dotcom %}.
4344

@@ -54,7 +55,7 @@ To support the developer process in the next section, add two {% data variables.
5455

5556
### Example developer process
5657

57-
Here is an example process that you can follow to automatically run tests, create a release{% ifversion fpt%} and publish to {% data variables.product.prodname_marketplace %}{% endif %}, and publish your action.
58+
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.
5859

5960
1. Do feature work in branches per GitHub flow. For more information, see "[GitHub flow](/get-started/quickstart/github-flow)."
6061
* Whenever a commit is pushed to the feature branch, your testing workflow will automatically run the tests.
@@ -65,7 +66,7 @@ Here is an example process that you can follow to automatically run tests, creat
6566

6667
* **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/reference/events-that-trigger-workflows#manual-events) or a [`pull_request_target`](/actions/reference/events-that-trigger-workflows#pull_request_target). Read more [here](/actions/reference/events-that-trigger-workflows#pull-request-events-for-forked-repositories).
6768

68-
3. Create a semantically tagged release. {% ifversion fpt %} You may also publish to {% data variables.product.prodname_marketplace %} with a simple checkbox. {% endif %} For more information, see "[Managing releases in a repository](/github/administering-a-repository/managing-releases-in-a-repository#creating-a-release)"{% ifversion fpt %} and "[Publishing actions in {% data variables.product.prodname_marketplace %}](/actions/creating-actions/publishing-actions-in-github-marketplace#publishing-an-action)"{% endif %}.
69+
3. Create a semantically tagged release. {% ifversion fpt or ghec %} You may also publish to {% data variables.product.prodname_marketplace %} with a simple checkbox. {% endif %} For more information, see "[Managing releases in a repository](/github/administering-a-repository/managing-releases-in-a-repository#creating-a-release)"{% ifversion fpt or ghec %} and "[Publishing actions in {% data variables.product.prodname_marketplace %}](/actions/creating-actions/publishing-actions-in-github-marketplace#publishing-an-action)"{% endif %}.
6970

7071
* When a release is published or edited, your release workflow will automatically take care of compilation and adjusting tags.
7172

@@ -82,7 +83,7 @@ Using semantic releases means that the users of your actions can pin their workf
8283
{% data variables.product.product_name %} provides tools and guides to help you work with the open source community. Here are a few tools we recommend setting up for healthy bidirectional communication. By providing the following signals to the community, you encourage others to use, modify, and contribute to your action:
8384

8485
* Maintain a `README` with plenty of usage examples and guidance. For more information, see "[About READMEs](/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-readmes)."
85-
* Include a workflow status badge in your `README` file. For more information, see "[Adding a workflow status badge](/actions/managing-workflow-runs/adding-a-workflow-status-badge)." Also visit [shields.io](https://shields.io/) to learn about other badges that you can add.{% ifversion fpt %}
86+
* Include a workflow status badge in your `README` file. For more information, see "[Adding a workflow status badge](/actions/managing-workflow-runs/adding-a-workflow-status-badge)." Also visit [shields.io](https://shields.io/) to learn about other badges that you can add.{% ifversion fpt or ghec %}
8687
* Add community health files like `CODE_OF_CONDUCT`, `CONTRIBUTING`, and `SECURITY`. For more information, see "[Creating a default community health file](/github/building-a-strong-community/creating-a-default-community-health-file#supported-file-types)."{% endif %}
8788
* Keep issues current by utilizing actions like [actions/stale](https://github.com/actions/stale).
8889

translations/es-ES/content/actions/deployment/targeting-different-environments/using-environments-for-deployment.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ You can configure environments with protection rules and secrets. When a workflo
2626
{% ifversion fpt %}
2727
{% note %}
2828

29-
**Note:** If you don't use {% data variables.product.prodname_ghe_cloud %} and 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. {% data reusables.enterprise.link-to-ghec-trial %}
29+
**Note:** You 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.
30+
31+
Organizations that use {% data variables.product.prodname_ghe_cloud %} can configure environments for private repositories. For more information, see the [{% data variables.product.prodname_ghe_cloud %} documentation](/enterprise-cloud@latest/actions/deployment/targeting-different-environments/using-environments-for-deployment). {% data reusables.enterprise.link-to-ghec-trial %}
3032

3133
{% endnote %}
3234
{% endif %}

translations/es-ES/content/actions/guides.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,4 @@ includeGuides:
6565
- /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/automating-dependabot-with-github-actions
6666
- /code-security/supply-chain-security/keeping-your-dependencies-updated-automatically/keeping-your-actions-up-to-date-with-dependabot
6767
---
68+

translations/es-ES/content/actions/hosting-your-own-runners/adding-self-hosted-runners.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,13 @@ You can add self-hosted runners at the organization level, where they can be use
8181

8282
## Adding a self-hosted runner to an enterprise
8383

84-
You can add self-hosted runners to an enterprise, where they can be assigned to multiple organizations. The organization admins are then able to control which repositories can use it.
84+
{% ifversion fpt %}If you use {% data variables.product.prodname_ghe_cloud %}, you{% elsif ghec or ghes or ghae %}You{% endif %} can add self-hosted runners to an enterprise, where they can be assigned to multiple organizations. The organization admins are then able to 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/adding-self-hosted-runners#adding-a-self-hosted-runner-to-an-enterprise).{% endif %}
85+
86+
{% ifversion ghec or ghes or ghae %}
8587

8688
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 "[Managing access to self-hosted runners](/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups#moving-a-self-hosted-runner-to-a-group)."
8789

88-
{% ifversion fpt or ghec %}
90+
{% ifversion ghec %}
8991
To add a self-hosted runner to an enterprise account, you must be an enterprise owner. For information about how to add a self-hosted runner with the REST API, see the [Enterprise Administration GitHub Actions APIs](/rest/reference/enterprise-admin#github-actions).
9092

9193
{% data reusables.enterprise-accounts.access-enterprise %}
@@ -104,9 +106,11 @@ To add a self-hosted runner at the enterprise level of {% data variables.product
104106
1. Click **Add new**, then click **New runner**.
105107
{% data reusables.github-actions.self-hosted-runner-configure %}
106108
{% endif %}
109+
{% ifversion ghec or ghae or ghes %}
107110
{% data reusables.github-actions.self-hosted-runner-check-installation-success %}
108111

109112
{% data reusables.github-actions.self-hosted-runner-public-repo-access %}
113+
{% endif %}
110114

111115
### Making enterprise runners available to repositories
112116

@@ -115,3 +119,4 @@ By default, runners in an enterprise's "Default" self-hosted runner group are av
115119
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.
116120

117121
For more information on changing runner group access settings, see "[Managing access to self-hosted runners using groups](/actions/hosting-your-own-runners/managing-access-to-self-hosted-runners-using-groups#changing-the-access-policy-of-a-self-hosted-runner-group)."
122+
{% endif %}

0 commit comments

Comments
 (0)