Merge pull request #2 from ph-value/refactor/markdown-structure #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Fetch Files | |
| on: | |
| push: | |
| paths: | |
| - 'post/**' | |
| workflow_dispatch: # 수동으로도 실행 가능 | |
| jobs: | |
| fetch_and_trigger: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v2 | |
| with: | |
| node-version: '14' | |
| - name: Install Node.js dependencies | |
| run: npm install | |
| - name: Fetch GitHub file list | |
| run: node fetch_files.js | |
| - name: Commit and push changes | |
| run: | | |
| git config --local user.name "GitHub Actions" | |
| git config --local user.email "actions@github.com" | |
| git restore package-lock.json | |
| git add post_files.json | |
| git commit -m "Update post_files.json with the latest post data" | |
| git push | |
| env: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Trigger Build Workflow | |
| uses: actions/github-script@v6 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const dispatch = await github.rest.actions.createWorkflowDispatch({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| workflow_id: "deploy.yml", | |
| ref: "main", | |
| }); |