Skip to content

Commit

Permalink
fix: added more conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiancretu committed Feb 16, 2023
1 parent 02ad545 commit 5126379
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ export type WorkflowInput = {
*/
const getInputs = (): WorkflowInput => {
const pullRequest = context.payload.pull_request;

const state = pullRequest?.merged
? 'merged'
: pullRequest?.draft
Expand Down
6 changes: 1 addition & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ type PropertyResponse = {
const { inputs, pull_request } = getInputs();

const run = async (): Promise<void> => {
console.log(inputs.related_status);
if (inputs.notion_properties.pull_request?.relation && !inputs.related_status)
return;

if (!inputs.related_status) return;
const bodyNotionLinks = getUrlsFromString({
body: pull_request.body,
left_delimiter: inputs.left_delimiter,
Expand Down Expand Up @@ -63,7 +60,6 @@ const run = async (): Promise<void> => {
if (prProperty.type === SupportedType.relation) {
let relation;
const currentPullRequest = await getPullRequestPage();
console.log(currentPullRequest, relation);

if (!currentPullRequest) {
relation = await addPullRequestPage();
Expand Down
1 change: 1 addition & 0 deletions src/notion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const updatePullRequestPage = async (pageId: string) => {
*/
export const addPullRequestPage = async () => {
const stateId = await getPullRequestState();

if (!stateId) {
return;
}
Expand Down

0 comments on commit 5126379

Please sign in to comment.