Skip to content

Commit

Permalink
use node
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaapiehetaapie committed Feb 23, 2023
1 parent e91c31d commit fdd75ff
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/fetch-blog.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
name : Fetch Blog
name: Fetch Blog

on:
schedule:
- cron: '12 1 * * *'
- cron: "12 * * * *"

jobs:
cron:
runs-on: ubuntu-latest
steps:
- name: Call our API route
run: |
curl --request POST \
--url 'https://taiko.xyz/api/getPosts'
- name: Checkout repository
uses: actions/checkout@v3

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 16

- name: Install pnpm dependencies
uses: ./.github/actions/install-pnpm-dependencies

- name: Run getPosts
run: node packages/website/getPosts.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const arweave = Arweave.init({
protocol: "https",
});

export default async function getTransanctionIds(req, res) {
async function getTransanctionIds() {
await fetch("https://arweave.net/graphql", {
method: "POST",
headers: {
Expand Down Expand Up @@ -48,7 +48,6 @@ export default async function getTransanctionIds(req, res) {
.then((response) => {
getPosts(response);
})
.finally(() => res.send(200))
.catch();
}

Expand All @@ -70,9 +69,14 @@ async function getPosts(response) {
})
.then(() => {
const jsonString = JSON.stringify(posts);
fs.writeFile("./public/posts.json", jsonString, (err) => {});
fs.writeFile(
"packages/website/public/posts.json",
jsonString,
(err) => {}
);
})
.catch();
})
);
}
getTransanctionIds();

0 comments on commit fdd75ff

Please sign in to comment.