Run Index.js #1274
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: Run Index.js | |
| on: | |
| push: | |
| branches: | |
| - main # Triggers on push to the main branch | |
| workflow_dispatch: # Allows manual triggering via the GitHub UI | |
| schedule: | |
| - cron: '0 */3 * * *' | |
| jobs: | |
| run-index: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout the code | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # Set up Node.js | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| # Install dependencies | |
| - name: Install dependencies | |
| run: npm install | |
| # Run the index.js script | |
| - name: Run index.js | |
| run: npm run start | |
| # Run the logger script | |
| - name: Run logger.js | |
| run: npm run logger | |
| # Run the snippets script | |
| - name: Run snippets.js | |
| run: npm run snippets | |
| # Commit and push changes if there are any changes | |
| - name: Commit and Push changes | |
| run: | | |
| git config --global user.name "${{ secrets.USERNAME }}" | |
| git config --global user.email "${{ secrets.EMAIL }}" | |
| git add . | |
| git diff --cached | |
| git commit -m "New Data Detected && Updated Webpack Version" || echo "No changes to commit" | |
| git push | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |