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

Fixed some issues #4

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions functions/identify-new-content/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const getRecentCommits = async () => {
const result = await octokit.rest.repos.listCommits({
owner: process.env.OWNER,
repo: process.env.REPO,
path: process.env.PATH,
path: process.env.CONTENT_PATH,
since: date.toISOString()
});

Expand All @@ -53,7 +53,7 @@ const getNewContent = async (commits) => {
ref: commit
});

const newFiles = commitDetail.data.files.filter(f => f.status == 'added' && f.filename.startsWith(`${process.env.PATH}/`));
const newFiles = commitDetail.data.files.filter(f => f.status == 'added' && f.filename.startsWith(`${process.env.CONTENT_PATH}/`));
return newFiles.map(p => {
return {
fileName: p.filename,
Expand Down Expand Up @@ -119,4 +119,4 @@ const processNewContent = async (newContent) => {
console.error(execution.reason);
}
}
};
};
5 changes: 4 additions & 1 deletion functions/parse-post/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ const formatHashnodeData = (postDetail, articleCatalog, links, tweets) => {
publicationId: process.env.HASHNODE_PUBLICATION_ID,
input: {
title: postDetail.data.title,
isPartOfPublication: {
publicationId: process.env.HASHNODE_PUBLICATION_ID
},
contentMarkdown: hashnodeContent,
coverImageURL: postDetail.data.image,
isRepublished: {
Expand All @@ -140,4 +143,4 @@ const getTweets = (postContent) => {

const getTweetUrl = (tweet) => {
return `https://twitter.com/${tweet[1]}/status/${tweet[2]}`;
}
}
4 changes: 2 additions & 2 deletions template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ Resources:
REPO: !Ref GitHubRepo
COMMIT_TIME_TOLERANCE_MINUTES: 10
STATE_MACHINE_ARN: !Ref CrossPostStateMachine
PATH: !Ref BlogContentPath
CONTENT_PATH: !Ref BlogContentPath
NEW_CONTENT_INDICATOR: "[blog]"
SEND_STATUS_EMAIL: !If [ShouldSendStatusEmail, 'true', 'false']
Events:
Expand Down Expand Up @@ -303,4 +303,4 @@ Resources:
Properties:
Pattern:
detail-type:
- Send Email
- Send Email