Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(changelogs): Migrate fetchReleaseNotes to fetchChangeLogs #25364

Merged
24 changes: 12 additions & 12 deletions docs/usage/configuration-options.md
illay1994 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -1291,29 +1291,29 @@ A similar one could strip leading `v` prefixes:
}
```

## fetchReleaseNotes
## fetchChangeLogs
illay1994 marked this conversation as resolved.
Show resolved Hide resolved

Use this config option to configure release notes fetching.
Use this config option to configure changelogs/release notes fetching.
The available options are:

- `off` - disable release notes fetching
- `branch` - fetch release notes while creating/updating branch
- `pr`(default) - fetches release notes while creating/updating pull-request
- `off` - disable changelogs fetching
- `branch` - fetch changelogs while creating/updating branch
- `pr`(default) - fetches changelogs while creating/updating pull-request

It is not recommended to set fetchReleaseNotes=branch unless you are embedding release notes in commit information, because it results in a performance decrease.
It is not recommended to set fetchChangeLogs=branch unless you are embedding changelogs in commit information, because it results in a performance decrease.
illay1994 marked this conversation as resolved.
Show resolved Hide resolved

Renovate can fetch release notes when they are hosted on one of these platforms:
Renovate can fetch changelogs when they are hosted on one of these platforms:

- Bitbucket Cloud
- GitHub (.com and Enterprise Server)
- GitLab (.com and CE/EE)

If you are running on any platform except `github.com`, you need to [configure a Personal Access Token](./getting-started/running.md#githubcom-token-for-release-notes) to allow Renovate to fetch release notes from `github.com`.
If you are running on any platform except `github.com`, you need to [configure a Personal Access Token](./getting-started/running.md#githubcom-token-for-release-notes) to allow Renovate to fetch changelogs notes from `github.com`.

<!-- prettier-ignore -->
!!! note
Renovate can only show release notes from some platforms and some package managers.
We're planning improvements so that Renovate can show more release notes.
Renovate can only show changelogs from some platforms and some package managers.
We're planning improvements so that Renovate can show more changelogs.
Read [issue 14138 on GitHub](https://github.com/renovatebot/renovate/issues/14138) to get an overview of the planned work.

## fileMatch
Expand Down Expand Up @@ -2793,9 +2793,9 @@ Tokens can be configured via `hostRules` using the `"merge-confidence"` `hostTyp
### customChangelogUrl

Use this field to set the source URL for a package, including overriding an existing one.
Source URLs are necessary in order to look up release notes.
Source URLs are necessary in order to look up changelogs.

Using this field we can specify the exact URL to fetch release notes from.
Using this field we can specify the exact URL to fetch changelogs from.

Example setting source URL for package "dummy":

Expand Down
2 changes: 1 addition & 1 deletion docs/usage/dependency-pinning.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ If you were using SemVer ranges then this new version of `foobar` will likely be
Like before, you need to manually work out which dependency caused it - assuming you guess correctly that it was a new dependency version at fault - and pin it manually by editing `package.json` one dependency at a time.

Alternatively, if you were instead pinning `foobar` then you would get a PR for `foobar@1.2.0` which awaits your approval.
So first of all, you can choose to read the release notes and/or visually inspect the branch yourself before merging, hopefully saving you from pushing this faulty code to production.
So first of all, you can choose to read the changelogs and/or visually inspect the branch yourself before merging, hopefully saving you from pushing this faulty code to production.

If you did not catch the fault before merging, you are still better off with a pinned version.
If you discover something wrong in production, you can easily "roll back" commits in your development environment until you find which rollback fixes the problem.
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/examples/self-hosting.md
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ Only add the script to cron after you checked it works.

<!-- prettier-ignore -->
!!! note
The GitHub.com token as an environment variable is needed to fetch Release Notes that are usually hosted on github.com.
The GitHub.com token as an environment variable is needed to fetch changelogs that are usually hosted on github.com.
You don't need to add it if you are already running the bot against github.com, but you do need to add it if you're using GitHub Enterprise Server, GitLab, Azure DevOps, or Bitbucket.

## Kubernetes for GitLab, using Git over SSH
Expand Down
6 changes: 3 additions & 3 deletions docs/usage/getting-started/private-packages.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ There are four times in Renovate's behavior when it may need credentials:

- Resolving private config presets
- Looking up dependency versions
- Looking up release notes
- Looking up changelogs
- Passing to package managers when updating lock files or checksums

<!-- prettier-ignore -->
Expand Down Expand Up @@ -144,14 +144,14 @@ Assume this config is used on the `github.com/some-other-org` repo:
}
```

## Looking up Release Notes
## Looking up changelogs

When Renovate creates Pull Requests, its default behavior is to locate and embed release notes/changelogs of packages.
These release notes are fetched from the source repository of packages and not from the registries themselves, so if they are private then they will require different credentials.

When it comes to open source, most packages host their source on `github.com` in public repositories.
GitHub greatly rate limits unauthenticated API requests, so you need to configure credentials for `github.com` or the bot will get rate limited quickly.
It can be confusing for people who host their own source code privately to be asked to configure a `github.com` token but without it Release Notes for most open source packages will be blocked.
It can be confusing for people who host their own source code privately to be asked to configure a `github.com` token but without it changelogs for most open source packages will be blocked.

Currently the preferred way to configure `github.com` credentials for self-hosted Renovate is:

Expand Down
4 changes: 2 additions & 2 deletions docs/usage/getting-started/running.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,11 @@ Read the platform-specific docs to learn how to setup authentication on your pla
- [github.com and GitHub Enterprise Server](https://docs.renovatebot.com/modules/platform/github/)
- [GitLab](https://docs.renovatebot.com/modules/platform/gitlab/)

### GitHub.com token for release notes
### GitHub.com token for changelogs

If you are running on any platform except github.com, you should also set the environment variable `GITHUB_COM_TOKEN` and put the Personal Access Token for github.com in it.
This account can be _any_ account on GitHub, and needs only `read-only` access.
It's used when fetching release notes for repositories in order to increase the hourly API limit.
It's used when fetching changelogs for repositories in order to increase the hourly API limit.
It's also OK to configure the same as a host rule instead, if you prefer that.

<!-- prettier-ignore -->
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/getting-started/use-cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Renovate:
1. Checks if any newer versions exist
1. Raises Pull Requests for available updates

The Pull Requests patch the package files directly, and include Release Notes for the newer versions (if they are available).
The Pull Requests patch the package files directly, and include changelogs for the newer versions (if they are available).

By default:

Expand Down
2 changes: 1 addition & 1 deletion docs/usage/key-concepts/automerge.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This means merging multiple branches in a row won't work reliably, so we prefer
What all this means is that Renovate will only automerge at most one branch/PR per target branch per run, before you need to wait for the next run.

As a general guide, we recommend that you enable automerge for any type of dependency updates where you would select "merge" anyway.
For any updates where you want to review the release notes - or code - before you merge, you can keep automerge disabled.
For any updates where you want to review the changelogs - or code - before you merge, you can keep automerge disabled.

Automerge works particularly well for `devDependencies` as well as for production `dependencies` in projects which have great test coverage.

Expand Down
2 changes: 1 addition & 1 deletion docs/usage/self-hosted-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ Override this object if you want to change the URLs that Renovate links to, e.g.
## redisUrl

If this value is set then Renovate will use Redis for its global cache instead of the local file system.
The global cache is used to store lookup results (e.g. dependency versions and release notes) between repositories and runs.
The global cache is used to store lookup results (e.g. dependency versions and changelogs) between repositories and runs.
Example URL structure: `redis://[[username]:[password]]@localhost:6379/0`.

## repositories
Expand Down
rarkins marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,39 @@ describe('config/migrations/custom/fetch-release-notes-migration', () => {
fetchReleaseNotes: false as never,
},
{
fetchReleaseNotes: 'off',
fetchChangeLogs: 'off',
}
);
expect(FetchReleaseNotesMigration).toMigrate(
{
fetchReleaseNotes: true as never,
},
{
fetchChangeLogs: 'pr',
}
);
expect(FetchReleaseNotesMigration).toMigrate(
{
fetchReleaseNotes: 'pr',
},
{
fetchChangeLogs: 'pr',
}
);
expect(FetchReleaseNotesMigration).toMigrate(
{
fetchReleaseNotes: 'off',
},
{
fetchChangeLogs: 'off',
}
);
expect(FetchReleaseNotesMigration).toMigrate(
{
fetchReleaseNotes: 'branch',
},
{
fetchChangeLogs: 'branch',
}
);
});
Expand Down
11 changes: 10 additions & 1 deletion lib/config/migrations/custom/fetch-release-notes-migration.ts
illay1994 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import is from '@sindresorhus/is';
import type { FetchChangeLogsOptions } from '../../types';
import { AbstractMigration } from '../base/abstract-migration';

export class FetchReleaseNotesMigration extends AbstractMigration {
illay1994 marked this conversation as resolved.
Show resolved Hide resolved
override deprecated = true;
override readonly propertyName = 'fetchReleaseNotes';

readonly newPropertyName = 'fetchChangeLogs';

override run(value: unknown): void {
let newValue: FetchChangeLogsOptions | undefined;
illay1994 marked this conversation as resolved.
Show resolved Hide resolved
if (is.boolean(value)) {
this.rewrite(value ? 'pr' : 'off');
newValue = value ? 'pr' : 'off';
} else if (value === 'off' || value === 'pr' || value === 'branch') {
newValue = value;
}

this.setSafely(this.newPropertyName, newValue);
illay1994 marked this conversation as resolved.
Show resolved Hide resolved
}
}
4 changes: 2 additions & 2 deletions lib/config/options/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2620,8 +2620,8 @@ const options: RenovateOptions[] = [
env: false,
},
{
name: 'fetchReleaseNotes',
description: 'Controls if and when release notes are fetched.',
name: 'fetchChangeLogs',
description: 'Controls if and when changelogs/release notes are fetched.',
type: 'string',
allowedValues: ['off', 'branch', 'pr'],
default: 'pr',
Expand Down
4 changes: 2 additions & 2 deletions lib/config/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ export interface RenovateConfig
customManagers?: CustomManager[];
customDatasources?: Record<string, CustomDatasourceConfig>;

fetchReleaseNotes?: FetchReleaseNotesOptions;
fetchChangeLogs?: FetchChangeLogsOptions;
secrets?: Record<string, string>;

constraints?: Record<string, string>;
Expand Down Expand Up @@ -298,7 +298,7 @@ export type UpdateType =
| 'bump'
| 'replacement';

export type FetchReleaseNotesOptions = 'off' | 'branch' | 'pr';
export type FetchChangeLogsOptions = 'off' | 'branch' | 'pr';

export type MatchStringsStrategy = 'any' | 'recursive' | 'combination';

Expand Down
2 changes: 1 addition & 1 deletion lib/workers/repository/update/branch/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -836,7 +836,7 @@ describe('workers/repository/update/branch/index', () => {
ignoreTests: true,
prCreation: 'not-pending',
commitBody: '[skip-ci]',
fetchReleaseNotes: 'branch',
fetchChangeLogs: 'branch',
} satisfies BranchConfig;
scm.getBranchCommit.mockResolvedValue('123test'); //TODO:not needed?
expect(await branchWorker.processBranch(inconfig)).toEqual({
Expand Down
2 changes: 1 addition & 1 deletion lib/workers/repository/update/branch/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ export async function processBranch(
} else {
logger.debug('No updated lock files in branch');
}
if (config.fetchReleaseNotes === 'branch') {
if (config.fetchChangeLogs === 'branch') {
await embedChangelogs(config.upgrades);
}

Expand Down
10 changes: 5 additions & 5 deletions lib/workers/repository/update/pr/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ describe('workers/repository/update/pr/index', () => {
platform.createPr.mockResolvedValueOnce(pr);
limits.isLimitReached.mockReturnValueOnce(true);

config.fetchReleaseNotes = 'pr';
config.fetchChangeLogs = 'pr';

const res = await ensurePr(config);

Expand Down Expand Up @@ -871,13 +871,13 @@ describe('workers/repository/update/pr/index', () => {
bodyFingerprint: fingerprint(
generatePrBodyFingerprintConfig({
...config,
fetchReleaseNotes: 'pr',
fetchChangeLogs: 'pr',
})
),
lastEdited: new Date('2020-01-20T00:00:00Z').toISOString(),
};
prCache.getPrCache.mockReturnValueOnce(cachedPr);
const res = await ensurePr({ ...config, fetchReleaseNotes: 'pr' });
const res = await ensurePr({ ...config, fetchChangeLogs: 'pr' });
expect(res).toEqual({
type: 'with-pr',
pr: existingPr,
Expand All @@ -904,13 +904,13 @@ describe('workers/repository/update/pr/index', () => {
bodyFingerprint: fingerprint(
generatePrBodyFingerprintConfig({
...config,
fetchReleaseNotes: 'pr',
fetchChangeLogs: 'pr',
})
),
lastEdited: new Date('2020-01-20T00:00:00Z').toISOString(),
};
prCache.getPrCache.mockReturnValueOnce(cachedPr);
const res = await ensurePr({ ...config, fetchReleaseNotes: 'pr' });
const res = await ensurePr({ ...config, fetchChangeLogs: 'pr' });
expect(res).toEqual({
type: 'with-pr',
pr: {
Expand Down
2 changes: 1 addition & 1 deletion lib/workers/repository/update/pr/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ export async function ensurePr(
}`;
}

if (config.fetchReleaseNotes === 'pr') {
if (config.fetchChangeLogs === 'pr') {
// fetch changelogs when not already done;
await embedChangelogs(upgrades);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/workers/repository/updates/branchify.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ describe('workers/repository/updates/branchify', () => {
});

it('no fetch changelogs', async () => {
config.fetchReleaseNotes = 'off';
config.fetchChangeLogs = 'off';
flattenUpdates.mockResolvedValueOnce([
{
depName: 'foo',
Expand Down