Skip to content

Commit 27a7577

Browse files
committed
fix: adds support for main branch
1 parent 0fcdb8f commit 27a7577

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

update_notion/index.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ try {
1010

1111
if (GITHUB_REF === 'refs/heads/master') {
1212
_updateNotionStatuses('master')
13+
} else if (GITHUB_REF === 'refs/heads/main') {
14+
_updateNotionStatuses('main')
1315
} else if (GITHUB_REF === 'refs/heads/staging') {
1416
_updateNotionStatuses('staging')
1517
} else if (GITHUB_REF === 'refs/heads/dev') {
@@ -46,7 +48,6 @@ async function _updateNotionStatuses (branch) {
4648
})
4749

4850
const repositoryName = GITHUB_REPOSITORY.split('/').pop()
49-
console.log(repositoryName)
5051

5152
// Get most recent commit to branch
5253
const { data } = await octokit.rest.repos.getCommit({
@@ -65,9 +66,14 @@ async function _updateNotionStatuses (branch) {
6566

6667
switch (branch) {
6768
case 'master':
69+
case 'main':
6870
if (commitMessage.includes('from coursedog/staging')) {
6971
// Update all tasks that are in Completed Staging to Completed Prod
7072
notionUtil.updateByStatus('Completed (Staging)', 'Completed (Production)')
73+
} else if (commitMessage.match(/#+[0-9]/)) {
74+
// direct from open PR to staging
75+
const prNumber = commitMessage.split('#')[1].replace(/\D/g, '')
76+
notionUtil.updateByPR(`${repositoryName}/pull/${prNumber}`, 'Completed (Production)')
7177
}
7278
break
7379
case 'staging':

0 commit comments

Comments
 (0)