Skip to content

Commit

Permalink
Add workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
NY0510 committed Jan 5, 2024
1 parent f14b97a commit fdbaa70
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/IndexNow.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

commit_message=$(git log -1 --pretty=format:"%s")

# 커밋 메시지가 'new post: '로 시작할 때만
if [[ $commit_message == "new post: "* ]]; then
title=${commit_message#"new post: "} # 'new post: ' 부분을 제거하여 제목만 추출

curl -X POST -H "Content-Type: application/json" \
-d '{
"url": "https://blog.ny64.kr/posts/'"$title"'",
"type": "URL_UPDATED"
}' \
"https://indexing.googleapis.com/v3/urlNotifications:publish?key=YOUR_API_KEY"
else
echo "Not a new post. Do nothing."
fi

0 comments on commit fdbaa70

Please sign in to comment.