From bcfb4ffb6af232f36d47bacd8a640a3b08071187 Mon Sep 17 00:00:00 2001 From: William Harrison Date: Sun, 7 May 2023 19:41:36 +0800 Subject: [PATCH] use checkout on raw api (#103) * Update raw-api.yml * fix typo * feat: use checkout, not creating dir * feat: update path * feat: no need for cd --- .github/workflows/raw-api.yml | 16 +++++++--------- scripts/raw-api.js | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/raw-api.yml b/.github/workflows/raw-api.yml index 0fb5eba..7688bbe 100644 --- a/.github/workflows/raw-api.yml +++ b/.github/workflows/raw-api.yml @@ -16,27 +16,25 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v3 + - uses: actions/checkout@v3 + + - uses: actions/checkout@v3 + with: + repository: free-domains/raw-api + path: main - name: Setup Node uses: actions/setup-node@v2 with: node-version: 16 - - name: Create raw-api Directory - run: | - mkdir raw-api - echo "raw.freesubdomains.org" > ./raw-api/CNAME - echo "" > ./raw-api/index.json - - name: Execute Script run: node scripts/raw-api.js - name: Commit uses: cpina/github-action-push-to-another-repository@main with: - source-directory: "raw-api" + source-directory: "main" destination-github-username: free-domains destination-repository-name: raw-api user-email: bot@freesubdomains.org diff --git a/scripts/raw-api.js b/scripts/raw-api.js index ec910b4..3ee959d 100644 --- a/scripts/raw-api.js +++ b/scripts/raw-api.js @@ -34,7 +34,7 @@ fs.readdir(directoryPath, function (err, files) { combinedArray = combinedArray.concat(dataArray); if (combinedArray.length === files.length) { - fs.writeFile("raw-api/index.json", JSON.stringify(combinedArray), (err) => { + fs.writeFile("main/index.json", JSON.stringify(combinedArray), (err) => { if (err) throw err; }); }