Skip to content

Commit f13e453

Browse files
committed
fix: switch from master to main as default branch
1 parent 8c05488 commit f13e453

8 files changed

Lines changed: 12 additions & 12 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ This repository provides a npx script to patch the release notes in our document
1111

1212
## Use Case 2 - Upcoming Release
1313

14-
**Goal:** Add every merge to master to the upcoming release notes to simplify the preparation for the next release
14+
**Goal:** Add every merge to main to the upcoming release notes to simplify the preparation for the next release
1515

16-
**How:** With every merge to `master` on the `livingdocs-server` and `livingdocs-editor`, the script gets the PR information and pushes it on top of the [upcoming release](https://docs.livingdocs.io/operations/releases/master/) in the documentation repository.
16+
**How:** With every merge to `main` on the `livingdocs-server` and `livingdocs-editor`, the script gets the PR information and pushes it on top of the upcoming release in the documentation repository.
1717

1818
# Usage
1919

cli.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env node
2-
console.log('release-notes-patch -> v1.6.1 (handle when no PR has been opened)')
2+
console.log('release-notes-patch -> v1.6.2 (switch docu repo from master to main as default branch)')
33
const argv = require('yargs')
44
.demandOption(['token', 'owner', 'repo', 'sha', 'tag'])
55
.help(false)

index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ const branches = createBranchList({
1414
time: moment(Date.now()).format('YYYY-MM'),
1515
months: {before: 8, after: 4}
1616
})
17-
// add 'master' to live patch the upcoming release notes
18-
branches.push('master')
17+
// add 'main' to live patch the upcoming release notes
18+
branches.push('main')
1919

2020
const targetOwner = 'livingdocsIO'
2121
const targetRepo = 'documentation'
@@ -39,9 +39,9 @@ module.exports = async ({token, owner, repo, sha, tag, test = false} = {}) => {
3939

4040
let patchedReleaseNotes
4141
// patch release notes detail for upcoming release
42-
if (release.branchName === 'master') {
42+
if (release.branchName === 'main') {
4343
const pull = await getPullBySha({owner, repo, token, sha})
44-
if (!pull) return `Release notes will not be extended, because no PR found for commit ${sha} in ${owner}/${repo}. \nThis happens when someone pushes to master without opening a PR.`
44+
if (!pull) return `Release notes will not be extended, because no PR found for commit ${sha} in ${owner}/${repo}. \nThis happens when someone pushes to main without opening a PR.`
4545
patchedReleaseNotes = addPatchToUpcomingReleaseNote({
4646
repo,
4747
releaseNote: originReleaseNote,

lib/add-patch-to-release-note.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ module.exports = ({owner, repo, releaseNote, tag, path, message}) => {
88
// do nothing when tag info already exists in release notes
99
if (releaseNote.includes(tag)) {
1010
throw (new Error(
11-
`https://github.com/${owner}/${repo}/blob/master/${path} will not be updated, because ${tag} is already documented`
11+
`https://github.com/${owner}/${repo}/blob/main/${path} will not be updated, because ${tag} is already documented`
1212
))
1313
}
1414

lib/get-release-note.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = async ({owner, repo, path, token}) => {
77
repo,
88
token,
99
path,
10-
branch: 'master'
10+
branch: 'main'
1111
})
1212
} catch (error) {
1313
console.log(err)

lib/git/get-content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const axios = require('axios')
44
//
55
// @return
66
module.exports = async ({
7-
owner, repo, token, path, branch = 'master'
7+
owner, repo, token, path, branch = 'main'
88
}) => {
99
try {
1010
const res = await axios({

lib/git/get-pull-by-sha.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = async ({owner, repo, token, sha}) => {
1212
}
1313
})
1414

15-
// when someone pushes to master without opening a PR
15+
// when someone pushes to main without opening a PR
1616
if(res.data.length === 0) return
1717

1818
return {

lib/git/update-content.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const axios = require('axios')
22

33
// https://docs.github.com/en/rest/reference/repos#create-or-update-file-contents
44
module.exports = async ({
5-
owner, repo, token, path, message, content, sha, branch = 'master'
5+
owner, repo, token, path, message, content, sha, branch = 'main'
66
}) => {
77
const res = await axios({
88
method: 'put',

0 commit comments

Comments
 (0)