From fc7856dfa7137ed65151c6aa49cab2b6cb10ad1a Mon Sep 17 00:00:00 2001 From: rahuldkjain Date: Sun, 26 Jul 2020 17:39:49 +0530 Subject: [PATCH] yml content --- package-lock.json | 5 +++++ package.json | 2 ++ src/pages/index.js | 4 ++++ src/utils/workflows.js | 22 ++++++++++++++++++++++ 4 files changed, 33 insertions(+) create mode 100644 src/utils/workflows.js diff --git a/package-lock.json b/package-lock.json index c017ed9..a4c205a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7595,6 +7595,11 @@ "readable-stream": "^2.0.0" } }, + "fs": { + "version": "0.0.1-security", + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", + "integrity": "sha1-invTcYa23d84E/I4WLV+yq9eQdQ=" + }, "fs-constants": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", diff --git a/package.json b/package.json index 9bfc45a..52093fb 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "author": "Rahul Jain ", "dependencies": { "@primer/octicons-react": "^10.0.0", + "fs": "0.0.1-security", "gatsby": "^2.23.12", "gatsby-image": "^2.4.9", "gatsby-plugin-google-analytics": "^2.3.11", @@ -16,6 +17,7 @@ "gatsby-source-filesystem": "^2.3.14", "gatsby-transformer-sharp": "^2.5.7", "gsap": "^3.4.0", + "js-yaml": "^3.14.0", "prop-types": "^15.7.2", "react": "^16.12.0", "react-dom": "^16.12.0", diff --git a/src/pages/index.js b/src/pages/index.js index 4e3aad2..46e5804 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -16,6 +16,7 @@ import './index.css' import { ArrowLeftIcon, CopyIcon, DownloadIcon, EyeIcon, CheckIcon, MarkdownIcon } from '@primer/octicons-react'; import SEO from '../components/seo'; import { isGithubUsernameValid } from '../utils/validation'; +import { latestBlogs } from '../utils/workflows'; const IndexPage = () => { const [prefix, setPrefix] = useState({ title: "Hi 👋, I'm", @@ -137,6 +138,9 @@ const IndexPage = () => { trimDataValues(data, setData); trimDataValues(social, setSocial); trimDataValues(link, setLink); + if (social.dev) { + latestBlogs(social.dev); + } resetCopyMarkdownButton(); if (data.visitorsBadge || data.githubStats) { if (social.github && isGithubUsernameValid(social.github)) { diff --git a/src/utils/workflows.js b/src/utils/workflows.js new file mode 100644 index 0000000..7a56b2c --- /dev/null +++ b/src/utils/workflows.js @@ -0,0 +1,22 @@ +const latestBlogs = (devUsername) => { + let rssFeed = 'https://dev.to/feed/' + devUsername + let data = ` + name: Latest blog post workflow + on: + schedule: + - cron: '0 * * * *' + jobs: + update-readme-with-blog: + name: Update this repo's README with latest blog posts + runs - on: ubuntu - latest + steps: + - uses: actions / checkout@v2 + - uses: gautamkrishnar / blog - post - workflow@master + with: + max_post_count: "4", + feed_list: "${rssFeed}"`; + + return data +} + +export { latestBlogs } \ No newline at end of file