[READ-ONLY] Mirror of https://github.com/danielroe/nuxt-nightly-action.
0

Configure Feed

Select the types of activity you want to include in your feed.

feat: support additional options

Daniel Roe (Dec 4, 2023, 4:54 PM UTC) 07089600 40328626

+28 -15
+5
action.yml
··· 9 9 10 10 inputs: 11 11 base: 12 + description: The base branch to raise the PR against. 12 13 required: false 13 14 head: 15 + description: The name of the branch to create with the changes. 14 16 default: ci/nuxt-nightly 17 + root: 18 + description: The directory containing your Nuxt project. 19 + default: . 15 20 16 21 runs: 17 22 using: node20
+10 -7
dist/index.js
··· 30805 30805 const node_child_process_1 = __nccwpck_require__(7718); 30806 30806 const core_1 = __nccwpck_require__(9093); 30807 30807 const github_1 = __nccwpck_require__(5942); 30808 - // TODO: configuration - point to Nuxt directory? (default repo root) 30809 - // TODO: add package resolutions for nuxt nightly versions 30810 - // TODO: dedupe dependencies 30811 - // TODO: create a long-running branch 30812 - // TODO: open a PR 30813 30808 const octokit = (0, github_1.getOctokit)(process.env.GITHUB_TOKEN); 30814 30809 const base = (0, core_1.getInput)('base') || (0, node_child_process_1.execSync)('git rev-parse --abbrev-ref HEAD', { encoding: 'utf-8' }).trim(); 30815 30810 const head = (0, core_1.getInput)('head'); 30811 + const root = (0, core_1.getInput)('root') || process.cwd(); 30816 30812 try { 30817 30813 (0, node_child_process_1.execSync)(`git checkout ${head}`); 30818 - (0, core_1.info)(`Checking out existing branch ${head}`); 30814 + (0, core_1.info)(`Checking out existing branch ${head} and discarding commits`); 30815 + (0, node_child_process_1.execSync)(`git reset --hard origin/${base}`); 30819 30816 } 30820 30817 catch (e) { 30821 30818 (0, core_1.info)(`Creating new branch ${head}`); ··· 30823 30820 } 30824 30821 (0, node_child_process_1.execSync)('git config --global user.email "nuxtbot@roe.dev"'); 30825 30822 (0, node_child_process_1.execSync)('git config --global user.name "🤖 Nuxtbot"'); 30826 - (0, node_child_process_1.execSync)('npx nuxi@latest upgrade --force'); 30823 + // Upgrade Nuxt packages 30824 + (0, node_child_process_1.execSync)('npx @antfu/ni -D nuxt@npm:nuxt-nightly@latest', { cwd: root }); 30825 + (0, node_child_process_1.execSync)('npx @antfu/ni -D @nuxt/kit@npm:@nuxt/kit-nightly@latest', { cwd: root }); 30826 + (0, node_child_process_1.execSync)('npx @antfu/ni -D @nuxt/schema@npm:@nuxt/schema-nightly@latest', { cwd: root }); 30827 + (0, node_child_process_1.execSync)('npx @antfu/ni -D @nuxt/vite-builder@npm:@nuxt/vite-builder-nightly@latest', { cwd: root }); 30828 + // TODO: dedupe dependencies 30829 + // TODO: add package resolutions for nuxt nightly versions 30827 30830 (0, node_child_process_1.execSync)('git commit -am "chore: upgrade nuxt"'); 30828 30831 (0, node_child_process_1.execSync)(`git push -u origin ${head}`); 30829 30832 octokit.rest.pulls.create({
+13 -8
src/index.ts
··· 3 3 import { getInput, info, warning } from '@actions/core' 4 4 import { context, getOctokit } from '@actions/github' 5 5 6 - // TODO: configuration - point to Nuxt directory? (default repo root) 7 - // TODO: add package resolutions for nuxt nightly versions 8 - // TODO: dedupe dependencies 9 - // TODO: create a long-running branch 10 - // TODO: open a PR 11 - 12 6 const octokit = getOctokit(process.env.GITHUB_TOKEN) 13 7 14 8 const base = getInput('base') || execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf-8' }).trim() 15 9 const head = getInput('head') 16 10 11 + const root = getInput('root') || process.cwd() 12 + 17 13 try { 18 14 execSync(`git checkout ${head}`) 19 - info(`Checking out existing branch ${head}`) 15 + info(`Checking out existing branch ${head} and discarding commits`) 16 + execSync(`git reset --hard origin/${base}`) 20 17 } catch (e) { 21 18 info(`Creating new branch ${head}`) 22 19 execSync(`git checkout -b ${head}`) ··· 25 22 execSync('git config --global user.email "nuxtbot@roe.dev"') 26 23 execSync('git config --global user.name "🤖 Nuxtbot"') 27 24 28 - execSync('npx nuxi@latest upgrade --force') 25 + // Upgrade Nuxt packages 26 + execSync('npx @antfu/ni -D nuxt@npm:nuxt-nightly@latest', { cwd: root }) 27 + execSync('npx @antfu/ni -D @nuxt/kit@npm:@nuxt/kit-nightly@latest', { cwd: root }) 28 + execSync('npx @antfu/ni -D @nuxt/schema@npm:@nuxt/schema-nightly@latest', { cwd: root }) 29 + execSync('npx @antfu/ni -D @nuxt/vite-builder@npm:@nuxt/vite-builder-nightly@latest', { cwd: root }) 30 + 31 + // TODO: dedupe dependencies 32 + // TODO: add package resolutions for nuxt nightly versions 33 + 29 34 execSync('git commit -am "chore: upgrade nuxt"') 30 35 execSync(`git push -u origin ${head}`) 31 36