test: bundle.test #27
This file contains 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: 'Custom action' | |
on: | |
push: | |
branches: | |
- '*' | |
- '!master' | |
jobs: | |
composite: | |
name: 'composite' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout to master | |
uses: actions/checkout@v3 | |
with: | |
ref: 'master' | |
path: br-base | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Bundle test | |
uses: actions/github-script@v7 | |
id: bundleTest | |
with: | |
result-encoding: string | |
script: | | |
const path = require('path'); | |
// const fs = require('fs'); | |
let packageJson = {}; | |
try { | |
const packageJsonPath = path.resolve(process.env.GITHUB_WORKSPACE, 'br-base', 'packageeee.json'); | |
// return require(packageJsonPath); | |
packageJson = require(packageJsonPath); | |
} catch (_) { | |
return {}; | |
} | |
// const script = require('./bundle.test.js'); | |
// const { version } = require('./package.json'); | |
// const files = fs.readdirSync(path.resolve(process.env.GITHUB_WORKSPACE, 'br-base')); | |
// const version = JSON.parse(fs.readFileSync(path.resolve(process.env.GITHUB_WORKSPACE, 'br-base', 'package.json'))).version; | |
// console.log('##workspace', process.env.GITHUB_WORKSPACE); | |
// console.log('##files', files); | |
// console.log('##version', version); | |
console.log('##packageeeeJsonVersion', packageJson.version || '-12'); | |
return 'Hi: Hello!'; | |
- name: Post report console | |
run: | | |
echo '${{ steps.bundleTest.outputs.result }}' | |
shell: bash |