test: bundle.test #42
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: Setup NodeJS v18.12.0 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.12.0' | |
- name: Checkout master | |
uses: actions/checkout@v3 | |
with: | |
ref: 'master' | |
path: master | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Put | |
uses: actions/github-script@v7 | |
id: puutt | |
with: | |
script: | | |
return { hi: 'hello!' }; | |
- name: Get | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
console.log('##github', Object.keys(github)); | |
console.log('##constext', Object.keys(context.job)); | |
# - name: Get master bundle report | |
# uses: actions/github-script@v7 | |
# id: getMasterBundleReport | |
# with: | |
# script: | | |
# const path = require('path'); | |
# const fs = require('fs'); | |
# try { | |
# const bundleReportPath = path.resolve(process.env.GITHUB_WORKSPACE, 'master', 'bundleReport.json'); | |
# return JSON.parse(fs.readFileSync(bundleReportPath)); | |
# } catch (_) { | |
# return {}; | |
# } | |
# - name: Checkout develop | |
# uses: actions/checkout@v3 | |
# - name: Build bundle | |
# run: npm ci && npm run build | |
# - name: Check bundle | |
# uses: actions/github-script@v7 | |
# with: | |
# script: | | |
# const checkBundle = require('./bundle.test.js'); | |
# console.log('##branchDir:', checkBundle({ baseDir: process.env.GITHUB_WORKSPACE })); | |
# - name: Get develop bundle report | |
# uses: actions/github-script@v7 | |
# id: getDevelopBundleReport | |
# with: | |
# script: | | |
# const { createReportObj } = require('./bundle.reportObj.js'); | |
# const res = createReportObj({ | |
# baseDir: process.env.GITHUB_WORKSPACE, | |
# bundlesDirsNames: ['dist', 'esm', 'umd'], | |
# }); | |
# console.log('##res', res); | |
# return res; | |
# - name: Create bundle report | |
# uses: actions/github-script@v7 | |
# id: bundleReport | |
# with: | |
# result-encoding: string | |
# script: | | |
# const { createReportMd } = require('./bundle.reportMd.js'); | |
# const next = context.steps.getDevelopBundleReport.outputs.result; | |
# console.log('##next', steps.getDevelopBundleReport.outputs.result); | |
# const res = createReportMd({ | |
# reportPrev: ${{ fromJson(steps.getMasterBundleReport.outputs.result) }}, | |
# reportNext: next, | |
# }); | |
# console.log('##res', res); | |
# return res; | |
# - name: Print result | |
# run: echo '${{ steps.bundleReport.outputs.result }}' |