diff --git a/.github/workflows/build-nightly.yml b/.github/workflows/build-nightly.yml new file mode 100644 index 000000000..d862ef2e1 --- /dev/null +++ b/.github/workflows/build-nightly.yml @@ -0,0 +1,12 @@ +name: Trigger Netlify Build +on: + schedule: + - cron: '0 2 * * *' # Once a day + workflow_dispatch: # On demand +jobs: + build: + name: Request Netlify Webhook + runs-on: ubuntu-latest + steps: + - name: POST to Build Hook + run: curl -X POST -d {} ${{ secrets.NETLIFY_BUILD_HOOK_URL }} diff --git a/internal/fetch-docs-oss.mjs b/internal/fetch-docs-oss.mjs index 2180ee57e..e064c5672 100644 --- a/internal/fetch-docs-oss.mjs +++ b/internal/fetch-docs-oss.mjs @@ -9,25 +9,30 @@ const __dirname = path.dirname(__filename); const repositories = [ { - name: 'multiqc', - url: 'https://github.com/MultiQC/MultiQC.git', - path: path.join(__dirname, "..", "multiqc_docs", "multiqc_repo") + name: "multiqc", + url: "https://github.com/MultiQC/MultiQC.git", + path: path.join(__dirname, "..", "multiqc_docs", "multiqc_repo"), + branch: "main", }, { - name: 'wave', - url: 'https://github.com/seqeralabs/wave.git', - path: path.join(__dirname, "..", "wave_docs", "wave_repo") - } + name: "wave", + url: "https://github.com/seqeralabs/wave.git", + path: path.join(__dirname, "..", "wave_docs", "wave_repo"), + branch: "master", + }, ]; // Function to clone or update a repository -async function cloneOrUpdateRepo({ name, url, path: repoPath }) { +async function cloneOrUpdateRepo({ name, url, path: repoPath, branch }) { const exists = await fs.pathExists(repoPath + "/.git"); - + try { if (exists) { - console.log(`${name}: Cloned repo already exists, will pull latest changes`); - await git(repoPath).pull(); + console.log( + `${name}: Cloned repo already exists, will pull latest changes`, + ); + // pull and checkout the branch + await git(repoPath).pull("origin", branch); console.log(`✅ ${name}: Pulled latest changes`); } else { console.log(`${name}: Cloning into ${repoPath}`); @@ -35,7 +40,7 @@ async function cloneOrUpdateRepo({ name, url, path: repoPath }) { console.log(`✅ ${name}: Cloned`); } } catch (error) { - console.error(`❌ Error processing ${repo.name}:`); + console.error(`❌ Error processing ${repoPath}:`); console.error(error.message); if (exists) { console.error(`Try removing the directory: ${repoPath}`); @@ -59,4 +64,4 @@ async function processRepositories() { } // Execute -processRepositories().catch(console.error); \ No newline at end of file +processRepositories().catch(console.error);