Skip to content

Commit

Permalink
Update release stats workflow (#17533)
Browse files Browse the repository at this point in the history
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
ijjk and kodiakhq[bot] committed Oct 3, 2020
1 parent 10f7b8f commit f27e1f8
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 13 deletions.
9 changes: 9 additions & 0 deletions .github/actions/next-stats-action/src/index.js
@@ -1,3 +1,5 @@
const path = require('path')
const fs = require('fs-extra')
const exec = require('./util/exec')
const logger = require('./util/logger')
const runConfigs = require('./run')
Expand Down Expand Up @@ -25,6 +27,13 @@ if (!allowedActions.has(actionInfo.actionName) && !actionInfo.isRelease) {

;(async () => {
try {
if (await fs.pathExists(path.join(process.cwd(), 'SKIP_NEXT_STATS.txt'))) {
console.log(
'SKIP_NEXT_STATS.txt file present, exiting stats generation..'
)
process.exit(0)
}

const { stdout: gitName } = await exec(
'git config user.name && git config user.email'
)
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/build_test_deploy.yml
Expand Up @@ -184,3 +184,14 @@ jobs:
key: ${{ github.sha }}

- run: ./publish-release.sh

prStats:
name: Release Stats
runs-on: ubuntu-latest
needs: [publishRelease]
steps:
- uses: actions/checkout@v2
- run: ./release-stats.sh
- uses: ./.github/actions/next-stats-action
env:
PR_STATS_COMMENT_TOKEN: ${{ secrets.PR_STATS_COMMENT_TOKEN }}
13 changes: 0 additions & 13 deletions .github/workflows/release_stats.yml

This file was deleted.

18 changes: 18 additions & 0 deletions release-stats.sh
@@ -0,0 +1,18 @@
#!/bin/bash

git describe --exact-match

if [[ ! $? -eq 0 ]];then
echo "Nothing to publish, exiting.."
touch SKIP_NEXT_STATS.txt
exit 0;
fi

if [[ -z "$NPM_TOKEN" ]];then
echo "No NPM_TOKEN, exiting.."
exit 0;
fi

echo "Publish occurred, running release stats..."
echo "Waiting 30 seconds to allow publish to finalize"
sleep 30

0 comments on commit f27e1f8

Please sign in to comment.