diff --git a/assets/images/help/settings/actions-access-settings.png b/assets/images/help/settings/actions-access-settings.png index 7a58fddaf6..82499feebc 100644 Binary files a/assets/images/help/settings/actions-access-settings.png and b/assets/images/help/settings/actions-access-settings.png differ diff --git a/components/landing/LandingSection.tsx b/components/landing/LandingSection.tsx index 037d227cdd..c17d1cfd6d 100644 --- a/components/landing/LandingSection.tsx +++ b/components/landing/LandingSection.tsx @@ -9,7 +9,7 @@ type Props = { } export const LandingSection = ({ title, children, className, sectionLink, description }: Props) => { return ( -
+
{title && (

{sectionLink ? ( diff --git a/components/playground/content/building-and-testing/nodejs.tsx b/components/playground/content/building-and-testing/nodejs.tsx index 88cd2ec794..0686d0feca 100644 --- a/components/playground/content/building-and-testing/nodejs.tsx +++ b/components/playground/content/building-and-testing/nodejs.tsx @@ -180,7 +180,11 @@ const article: PlaygroundArticleT = { type: 'sub-section', title: 'Example caching dependencies', content: dedent` - When using GitHub-hosted runners, you can cache dependencies using a unique key, and restore the dependencies when you run future workflows using the \`cache\` action. For more information, see [Caching dependencies to speed up workflows](/actions/guides/caching-dependencies-to-speed-up-workflows) and the [\`cache\` action](https://github.com/marketplace/actions/cache). + + When using GitHub-hosted runners, you can cache and restore the dependencies using the [\`setup-node\` action](https://github.com/actions/setup-node). To cache dependencies with the \`setup-node\` action, you must have a \`package-lock.json\`, \`yarn.lock\`, or \`pnpm-lock.yaml\` file in the root of the repository. + + If you have a custom requirement or need finer controls for caching, you can use the [\`cache\` action](https://github.com/marketplace/actions/cache). For more information, see [Caching dependencies to speed up workflows](/actions/guides/caching-dependencies-to-speed-up-workflows) and the [\`cache\` action](https://github.com/marketplace/actions/cache). + `, }, { @@ -493,15 +497,7 @@ const article: PlaygroundArticleT = { uses: actions/setup-node@v1 with: node-version: '12.x' - - name: Cache Node.js modules - uses: actions/cache@v2 - with: - # npm cache files are stored in \`~/.npm\` on Linux/macOS - path: ~/.npm - key: \${{ runner.OS }}-node-\${{ hashFiles('**/package-lock.json') }} - restore-keys: | - \${{ runner.OS }}-node- - \${{ runner.OS }}- + cache: 'npm' - name: Install dependencies run: npm ci `, diff --git a/components/playground/content/building-and-testing/python.tsx b/components/playground/content/building-and-testing/python.tsx index c39e9931fa..e64f2ccfc4 100644 --- a/components/playground/content/building-and-testing/python.tsx +++ b/components/playground/content/building-and-testing/python.tsx @@ -136,11 +136,11 @@ const article: PlaygroundArticleT = { }, title: 'Caching Dependencies', content: dedent` - When using GitHub-hosted runners, you can cache pip dependencies using a unique key, and restore the dependencies when you run future workflows using the [\`cache\`](https://github.com/marketplace/actions/cache) action. For more information, see "[Caching dependencies to speed up workflows](/actions/guides/caching-dependencies-to-speed-up-workflows)." - Pip caches dependencies in different locations, depending on the operating system of the runner. The path you'll need to cache may differ from the Ubuntu example shown depending on the operating system you use. For more information, see [Python caching examples](https://github.com/actions/cache/blob/main/examples.md#python---pip). + When using GitHub-hosted runners, you can cache and restore the dependencies using the [\`setup-python\` action](https://github.com/actions/setup-python). By default, the \`setup-python\` action searches for the dependency file (\`requirements.txt\` for pip or \`Pipfile.lock\` for pipenv) in the whole repository. + + If you have a custom requirement or need finer controls for caching, you can use the [\`cache\` action](https://github.com/marketplace/actions/cache). Pip caches dependencies in different locations, depending on the operating system of the runner. The path you'll need to cache may differ from the Ubuntu example shown here, depending on the operating system you use. For more information, see [Caching dependencies to speed up workflows](/actions/guides/caching-dependencies-to-speed-up-workflows) and the [\`cache\` action](https://github.com/marketplace/actions/cache). - **Note:** Depending on the number of dependencies, it may be faster to use the dependency cache. Projects with many large dependencies should see a performance increase as it cuts down the time required for downloading. Projects with fewer dependencies may not see a significant performance increase and may even see a slight decrease due to how pip installs cached dependencies. The performance varies from project to project. `, }, { @@ -392,16 +392,7 @@ const article: PlaygroundArticleT = { uses: actions/setup-python@v2 with: python-version: '3.x' - - name: Cache pip - uses: actions/cache@v2 - with: - # This path is specific to Ubuntu - path: ~/.cache/pip - # Look to see if there is a cache hit for the corresponding requirements file - key: \${{ runner.os }}-pip-\${{ hashFiles('requirements.txt') }} - restore-keys: | - \${{ runner.os }}-pip- - \${{ runner.os }}- + cache: 'pip' - name: Install dependencies run: pip install -r requirements.txt `, diff --git a/content/actions/advanced-guides/caching-dependencies-to-speed-up-workflows.md b/content/actions/advanced-guides/caching-dependencies-to-speed-up-workflows.md index 4d65afe249..603f7c540d 100644 --- a/content/actions/advanced-guides/caching-dependencies-to-speed-up-workflows.md +++ b/content/actions/advanced-guides/caching-dependencies-to-speed-up-workflows.md @@ -23,11 +23,34 @@ Jobs on {% data variables.product.prodname_dotcom %}-hosted runners start in a c To cache dependencies for a job, you'll need to use {% data variables.product.prodname_dotcom %}'s `cache` action. The action retrieves a cache identified by a unique key. For more information, see [`actions/cache`](https://github.com/actions/cache). -If you are caching Ruby gems, instead consider using the Ruby maintained action, which can cache bundle installs on initiation. For more information, see [`ruby/setup-ruby`](https://github.com/ruby/setup-ruby#caching-bundle-install-automatically). +If you are caching the package managers listed below, consider using the respective setup-* actions, which require almost zero configuration and are easy to use. -To cache and restore dependencies for npm, Yarn, or pnpm, you can use the [`actions/setup-node` action](https://github.com/actions/setup-node). - -Gradle and Maven caching is available with [`actions/setup-java` action](https://github.com/actions/setup-java). + + + + + + + + + + + + + + + + + + + + + + + + + +
Package managerssetup-* action for caching
npm, yarn, pnpmsetup-node
pip, pipenvsetup-python
gradle, mavensetup-java
ruby gemssetup-ruby
{% warning %} diff --git a/content/actions/automating-builds-and-tests/building-and-testing-nodejs.md b/content/actions/automating-builds-and-tests/building-and-testing-nodejs.md index e816c5b1f1..0715e07423 100644 --- a/content/actions/automating-builds-and-tests/building-and-testing-nodejs.md +++ b/content/actions/automating-builds-and-tests/building-and-testing-nodejs.md @@ -288,7 +288,7 @@ steps: - run: pnpm test ``` -To cache dependencies, you must have a `package-lock.json`, `yarn.lock`, or `pnpm-lock.yaml` file in the root of the repository. If you need more flexible customization, you can use the [`cache` action](https://github.com/marketplace/actions/cache). For more information, see "Caching dependencies to speed up workflows". +If you have a custom requirement or need finer controls for caching, you can use the [`cache` action](https://github.com/marketplace/actions/cache). For more information, see "Caching dependencies to speed up workflows". ## Building and testing your code diff --git a/content/actions/automating-builds-and-tests/building-and-testing-python.md b/content/actions/automating-builds-and-tests/building-and-testing-python.md index 2d1608fcb0..9b0b916538 100644 --- a/content/actions/automating-builds-and-tests/building-and-testing-python.md +++ b/content/actions/automating-builds-and-tests/building-and-testing-python.md @@ -241,38 +241,24 @@ steps: ### Caching Dependencies -When using {% data variables.product.prodname_dotcom %}-hosted runners, you can cache pip dependencies using a unique key, and restore the dependencies when you run future workflows using the [`cache`](https://github.com/marketplace/actions/cache) action. For more information, see "Caching dependencies to speed up workflows." +When using {% data variables.product.prodname_dotcom %}-hosted runners, you can cache and restore the dependencies using the [`setup-python` action](https://github.com/actions/setup-python). -Pip caches dependencies in different locations, depending on the operating system of the runner. The path you'll need to cache may differ from the Ubuntu example below depending on the operating system you use. For more information, see [Python caching examples](https://github.com/actions/cache/blob/main/examples.md#python---pip). +The following example caches dependencies for pip. -{% raw %} ```yaml{:copy} steps: - uses: actions/checkout@v2 -- name: Setup Python - uses: actions/setup-python@v2 +- uses: actions/setup-python@v2 with: - python-version: '3.x' -- name: Cache pip - uses: actions/cache@v2 - with: - # This path is specific to Ubuntu - path: ~/.cache/pip - # Look to see if there is a cache hit for the corresponding requirements file - key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }} - restore-keys: | - ${{ runner.os }}-pip- - ${{ runner.os }}- -- name: Install dependencies - run: pip install -r requirements.txt + python-version: '3.9' + cache: 'pip' +- run: pip install -r requirements.txt +- run: pip test ``` -{% endraw %} -{% note %} +By default, the `setup-python` action searches for the dependency file (`requirements.txt` for pip or `Pipfile.lock` for pipenv) in the whole repository. For more information, see "Caching packages dependencies" in the `setup-python` actions README. -**Note:** Depending on the number of dependencies, it may be faster to use the dependency cache. Projects with many large dependencies should see a performance increase as it cuts down the time required for downloading. Projects with fewer dependencies may not see a significant performance increase and may even see a slight decrease due to how pip installs cached dependencies. The performance varies from project to project. - -{% endnote %} +If you have a custom requirement or need finer controls for caching, you can use the [`cache` action](https://github.com/marketplace/actions/cache). Pip caches dependencies in different locations, depending on the operating system of the runner. The path you'll need to cache may differ from the Ubuntu example above, depending on the operating system you use. For more information, see [Python caching examples](https://github.com/actions/cache/blob/main/examples.md#python---pip) in the `cache` action repository. ## Testing your code diff --git a/content/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository.md b/content/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository.md index 94d25733ec..d934c5086a 100644 --- a/content/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository.md +++ b/content/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository.md @@ -128,8 +128,8 @@ To configure whether workflows in an internal repository can be accessed from ou 1. Under **Access**, choose one of the access settings: ![Set the access to Actions components](/assets/images/help/settings/actions-access-settings.png) * **Not accessible** - Workflows in other repositories can't use workflows in this repository. - * **Repositories in the <organization name> organization can access** - Workflows in other repositories can use workflows in this repository if they belong to the same organization and their visibility is private or internal. - * **Repositories in any organization belong to the <enterprise name> enterprise can access** - Workflows in other repositories can use workflows in this repository if they belong to the same enterprise and their visibility is private or internal. + * **Accessible from repositories in the '<organization name>' organization** - Workflows in other repositories can use workflows in this repository if they are part of the same organization and their visibility is private or internal. + * **Accessible from repositories in the '<enterprise name>' enterprise** - Workflows in other repositories can use workflows in this repository if they are part of the same enterprise and their visibility is private or internal. 1. Click **Save** to apply the settings. {% endif %} diff --git a/package-lock.json b/package-lock.json index 087519bee0..5fa2df795d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7,7 +7,6 @@ "name": "docs.github.com", "license": "(MIT AND CC-BY-4.0)", "dependencies": { - "@alex_neo/jest-expect-message": "^1.0.5", "@github/failbot": "0.7.0", "@hapi/accept": "^5.0.2", "@primer/components": "^31.1.0", @@ -65,7 +64,6 @@ "rate-limit-redis": "^2.1.0", "react": "^17.0.2", "react-dom": "^17.0.2", - "react-is": "^17.0.2", "react-markdown": "^7.1.0", "react-syntax-highlighter": "^15.4.4", "redis": "^3.1.2", @@ -98,6 +96,7 @@ "devDependencies": { "@actions/core": "^1.6.0", "@actions/github": "^5.0.0", + "@alex_neo/jest-expect-message": "^1.0.5", "@babel/core": "^7.16.0", "@babel/eslint-parser": "^7.16.3", "@babel/plugin-syntax-top-level-await": "^7.14.5", @@ -221,7 +220,8 @@ "node_modules/@alex_neo/jest-expect-message": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@alex_neo/jest-expect-message/-/jest-expect-message-1.0.5.tgz", - "integrity": "sha512-1eBykZCd0pPGl5qKtV6Z5ARA6yuhXzHsVN2h5GH5/H6svYa37Jr7vMio5OFpiw1LBHtscrZs7amSkZkcwm0cvQ==" + "integrity": "sha512-1eBykZCd0pPGl5qKtV6Z5ARA6yuhXzHsVN2h5GH5/H6svYa37Jr7vMio5OFpiw1LBHtscrZs7amSkZkcwm0cvQ==", + "dev": true }, "node_modules/@babel/code-frame": { "version": "7.16.0", @@ -22585,7 +22585,8 @@ "@alex_neo/jest-expect-message": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@alex_neo/jest-expect-message/-/jest-expect-message-1.0.5.tgz", - "integrity": "sha512-1eBykZCd0pPGl5qKtV6Z5ARA6yuhXzHsVN2h5GH5/H6svYa37Jr7vMio5OFpiw1LBHtscrZs7amSkZkcwm0cvQ==" + "integrity": "sha512-1eBykZCd0pPGl5qKtV6Z5ARA6yuhXzHsVN2h5GH5/H6svYa37Jr7vMio5OFpiw1LBHtscrZs7amSkZkcwm0cvQ==", + "dev": true }, "@babel/code-frame": { "version": "7.16.0", diff --git a/package.json b/package.json index ff4f836833..014982a070 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,6 @@ ".next/cache" ], "dependencies": { - "@alex_neo/jest-expect-message": "^1.0.5", "@github/failbot": "0.7.0", "@hapi/accept": "^5.0.2", "@primer/components": "^31.1.0", @@ -67,7 +66,6 @@ "rate-limit-redis": "^2.1.0", "react": "^17.0.2", "react-dom": "^17.0.2", - "react-is": "^17.0.2", "react-markdown": "^7.1.0", "react-syntax-highlighter": "^15.4.4", "redis": "^3.1.2", @@ -100,6 +98,7 @@ "devDependencies": { "@actions/core": "^1.6.0", "@actions/github": "^5.0.0", + "@alex_neo/jest-expect-message": "^1.0.5", "@babel/core": "^7.16.0", "@babel/eslint-parser": "^7.16.3", "@babel/plugin-syntax-top-level-await": "^7.14.5",