update actions/github-script from v5 to v7
[m6w6/m6w6.github.io] / .github / workflows / sync_site.yml
1 name: sync_site
2 on:
3 workflow_run:
4 workflows: [pages-build-deployment]
5 types: [completed]
6 env:
7 SYNC_SECRET: ${{ secrets.SYNC_SECRET }}
8 SYNC_COMMAND: ${{ secrets.SYNC_COMMAND }}
9 jobs:
10 sync:
11 runs-on: ubuntu-latest
12 steps:
13 - run: umask 0077 && echo "${{ env.SYNC_SECRET }}" >/tmp/sync_secret
14 - uses: actions/github-script@v7
15 with:
16 script: |
17 const artifact_id = await github.rest.actions.listWorkflowRunArtifacts({
18 owner: context.repo.owner,
19 repo: context.repo.repo,
20 run_id: context.payload.workflow_run.id,
21 per_page: 1,
22 });
23 const artifact = await github.rest.actions.downloadArtifact({
24 owner: context.repo.owner,
25 repo: context.repo.repo,
26 artifact_id: artifact_id.data.artifacts[0].id,
27 archive_format: "zip",
28 });
29 await exec.exec(process.env.SYNC_COMMAND, [], {
30 input: Buffer.from(artifact.data)
31 });