mirror of
https://github.com/himanshu8443/providers.git
synced 2026-04-18 05:51:45 +00:00
59 lines
1.8 KiB
YAML
59 lines
1.8 KiB
YAML
name: Check Provider URLs
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 0 * * *' # Run daily at midnight UTC
|
|
workflow_dispatch: # Allow manual triggering
|
|
|
|
# Very important - explicitly set permissions
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
check-urls:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
# No token specified - will use default GITHUB_TOKEN
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '18'
|
|
|
|
- name: Install dependencies
|
|
run: npm install axios
|
|
|
|
- name: Run URL checker
|
|
run: node .github/scripts/url-checker.js
|
|
|
|
# Simple push approach using the actions/github-script action
|
|
- name: Commit changes if any
|
|
uses: actions/github-script@v6
|
|
with:
|
|
script: |
|
|
const fs = require('fs');
|
|
const { execSync } = require('child_process');
|
|
|
|
// Check if there are changes to commit
|
|
try {
|
|
execSync('git add modflix.json');
|
|
const status = execSync('git status --porcelain').toString().trim();
|
|
|
|
if (status) {
|
|
console.log('Changes detected. Committing...');
|
|
execSync('git config --global user.name "GitHub Actions"');
|
|
execSync('git config --global user.email "actions@github.com"');
|
|
execSync('git commit -m "Update provider URLs [skip ci]"');
|
|
execSync('git push');
|
|
console.log('Changes committed and pushed successfully.');
|
|
} else {
|
|
console.log('No changes to commit.');
|
|
}
|
|
} catch (error) {
|
|
console.error('Error during git operations:', error);
|
|
process.exit(1);
|
|
}
|