update actions/github-script from v5 to v7
[m6w6/m6w6.github.io] / .github / workflows / sync_site.yml
index 288c4676b45d96c2debb6330e2c134f7568f8dd4..b5e18f881be2ecbf2ac71be9f5b4eb2a3065f88f 100644 (file)
@@ -1,16 +1,17 @@
-
 name: sync_site
-
 on:
   workflow_run:
     workflows: [pages-build-deployment]
     types: [completed]
-  
+env:
+  SYNC_SECRET: ${{ secrets.SYNC_SECRET }}
+  SYNC_COMMAND: ${{ secrets.SYNC_COMMAND }}
 jobs:
   sync:
     runs-on: ubuntu-latest
     steps:
-      - uses: actions/github-script@v5
+      - run: umask 0077 && echo "${{ env.SYNC_SECRET }}" >/tmp/sync_secret
+      - uses: actions/github-script@v7
         with:
           script: |
             const artifact_id = await github.rest.actions.listWorkflowRunArtifacts({
@@ -25,9 +26,6 @@ jobs:
               artifact_id: artifact_id.data.artifacts[0].id,
               archive_format: "zip",
             });
-            console.log(artifact_url);
-            github.exec.exec("tar xz", [], {
-              input: artifact.data
+            await exec.exec(process.env.SYNC_COMMAND, [], {
+              input: Buffer.from(artifact.data)
             });
-      - run: ls -al
-