Skip to content

Commit cddecd1

Browse files
committed
Correct readme location
1 parent 8a7fcdf commit cddecd1

File tree

4 files changed

+27
-12
lines changed

4 files changed

+27
-12
lines changed

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ inputs:
66
database_id:
77
description: "The id of the database"
88
required: true
9+
token_v2:
10+
description: "Your notion token_v2 string"
11+
required: true
912

1013
branding:
1114
icon: "box"

dist/README.md

Whitespace-only changes.

dist/index.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16686,6 +16686,7 @@ const core = __webpack_require__(470);
1668616686
const { NotionEndpoints } = __webpack_require__(897);
1668716687
const fs = __webpack_require__(747);
1668816688
const { commitFile } = __webpack_require__(543);
16689+
const path = __webpack_require__(622);
1668916690

1669016691
async function main() {
1669116692
try {
@@ -16782,9 +16783,11 @@ async function main() {
1678216783
.filter((block) => block.value.id !== databaseId)
1678316784
.map((block) => block.value);
1678416785

16785-
const readmeContent = fs.readFileSync('./README.md', 'utf-8').split('\n');
16786+
const readmeLines = fs
16787+
.readFileSync(__webpack_require__.ab + "README.md", 'utf-8')
16788+
.split('\n');
1678616789
// Find the index corresponding to <!--START_SECTION:notion_learn--> comment
16787-
let startIdx = readmeContent.findIndex(
16790+
let startIdx = readmeLines.findIndex(
1678816791
(content) => content.trim() === '<!--START_SECTION:notion_learn-->'
1678916792
);
1679016793

@@ -16796,7 +16799,7 @@ async function main() {
1679616799
}
1679716800

1679816801
// Find the index corresponding to <!--END_SECTION:notion_learn--> comment
16799-
const endIdx = readmeContent.findIndex(
16802+
const endIdx = readmeLines.findIndex(
1680016803
(content) => content.trim() === '<!--END_SECTION:notion_learn-->'
1680116804
);
1680216805

@@ -16805,12 +16808,15 @@ async function main() {
1680516808
);
1680616809

1680716810
const finalLines = [
16808-
...readmeContent.slice(0, startIdx + 1),
16811+
...readmeLines.slice(0, startIdx + 1),
1680916812
...newLines,
16810-
...readmeContent.slice(endIdx)
16813+
...readmeLines.slice(endIdx)
1681116814
];
1681216815

16813-
fs.writeFileSync('./README.md', finalLines.join('\n'));
16816+
fs.writeFileSync(
16817+
__webpack_require__.ab + "README.md",
16818+
finalLines.join('\n')
16819+
);
1681416820

1681516821
try {
1681616822
await commitFile();

src/index.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const core = require('@actions/core');
22
const { NotionEndpoints } = require('@nishans/endpoints');
33
const fs = require('fs');
44
const { commitFile } = require('./utils');
5+
const path = require('path');
56

67
async function main() {
78
try {
@@ -98,9 +99,11 @@ async function main() {
9899
.filter((block) => block.value.id !== databaseId)
99100
.map((block) => block.value);
100101

101-
const readmeContent = fs.readFileSync('./README.md', 'utf-8').split('\n');
102+
const readmeLines = fs
103+
.readFileSync(path.resolve(__dirname, '../README.md'), 'utf-8')
104+
.split('\n');
102105
// Find the index corresponding to <!--START_SECTION:notion_learn--> comment
103-
let startIdx = readmeContent.findIndex(
106+
let startIdx = readmeLines.findIndex(
104107
(content) => content.trim() === '<!--START_SECTION:notion_learn-->'
105108
);
106109

@@ -112,7 +115,7 @@ async function main() {
112115
}
113116

114117
// Find the index corresponding to <!--END_SECTION:notion_learn--> comment
115-
const endIdx = readmeContent.findIndex(
118+
const endIdx = readmeLines.findIndex(
116119
(content) => content.trim() === '<!--END_SECTION:notion_learn-->'
117120
);
118121

@@ -121,12 +124,15 @@ async function main() {
121124
);
122125

123126
const finalLines = [
124-
...readmeContent.slice(0, startIdx + 1),
127+
...readmeLines.slice(0, startIdx + 1),
125128
...newLines,
126-
...readmeContent.slice(endIdx)
129+
...readmeLines.slice(endIdx)
127130
];
128131

129-
fs.writeFileSync('./README.md', finalLines.join('\n'));
132+
fs.writeFileSync(
133+
path.resolve(__dirname, '../README.md'),
134+
finalLines.join('\n')
135+
);
130136

131137
try {
132138
await commitFile();

0 commit comments

Comments
 (0)