Merge pull request #314 from iambumblehead/add-log-function-for-debug #756
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: coverage | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 12 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- run: npm install | |
- run: npm run build --if-present | |
- run: | | |
{ PER=$(npm run test-cover | tee /dev/fd/3 | grep -oP "All\ files[^\d]*(\d\d?\.?\d?\d?)" | grep -oP "(\d\d?\.?\d?\d?)$"); } 3>&1 | |
echo "COVERAGE=$PER%" >> $GITHUB_ENV | |
# var REF = 'refs/pull/27/merge.json'; | |
REF=${{ github.ref }} | |
# console.log('github.ref: ' + REF); | |
echo "github.ref: $REF" | |
# var PATHS = REF.split('/'); | |
IFS='/' read -ra PATHS <<< "$REF" | |
# var BRANCH_NAME = PATHS[1] + '_' + PATHS[2]; | |
BRANCH_NAME="${PATHS[1]}_${PATHS[2]}" | |
# console.log(BRANCH_NAME); // 'pull_27' | |
echo $BRANCH_NAME | |
# process.env.BRANCH = 'pull_27'; | |
echo "BRANCH=$(echo ${BRANCH_NAME})" >> $GITHUB_ENV | |
- if: ${{ github.ref == 'refs/heads/main' }} | |
name: Create the Badge | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 166d927bd0089d7bfdee4e98a537712c | |
filename: esmock__${{ env.BRANCH }}.json | |
label: coverage | |
message: ${{ env.COVERAGE }} | |
color: "#44CC11" | |
namedLogo: node |