Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update release stats workflow #17533

Merged
merged 3 commits into from
Oct 3, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/actions/next-stats-action/src/index.js
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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