Skip to content

Waku integration

Waku integration #28

Workflow file for this run

name: Estimate
on:
pull_request:
jobs:
estimate:
name: Estimate
if: vars.JIRA_PROJECT_ID != ''
runs-on: ubuntu-20.04
steps:
- name: Start Check Run
id: check
env:
GH_TOKEN: ${{ github.token }}
run: |
CHECK_ID=$(gh api -X POST -H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-f 'name=Estimator' \
-f 'head_sha=${{ github.event.pull_request.head.sha }}' \
-f 'status=in_progress' \
-f 'output[title]=🎲 Estimation in progress' \
-f 'output[summary]=🎲 Estimation in progress' \
/repos/${{ github.repository }}/check-runs --jq '.id')
echo "check_id=$CHECK_ID" >> $GITHUB_OUTPUT
- name: Install estimator
run: npm install -g @amazeelabs/estimator
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Find common ancestor
id: ancestor
env:
BASE_BRANCH: ${{ github.base_ref }}
run:
echo "hash=$(git merge-base --fork-point origin/$BASE_BRANCH)" >>
$GITHUB_OUTPUT
- name: Estimate
id: estimate
env:
JIRA_PROJECT_ID: ${{ vars.JIRA_PROJECT_ID }}
PARENT_COMMIT: ${{ steps.ancestor.outputs.hash }}
DASHBOARD_ACCESS_TOKEN: ${{ secrets.DASHBOARD_ACCESS_TOKEN }}
run: echo "result=$(amazeelabs-estimator estimate)" >> $GITHUB_OUTPUT
continue-on-error: true
- name: Report success
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api -X PATCH -H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-f 'name=Estimator' \
-f 'head_sha=${{ github.event.pull_request.head.sha }}' \
-f 'conclusion=success' \
-f 'output[title]=🎲 ${{ steps.estimate.outputs.result }}' \
-f 'output[summary]=🎲 ${{ steps.estimate.outputs.result }}' \
/repos/${{ github.repository }}/check-runs/${{ steps.check.outputs.check_id }}
if: steps.estimate.outputs.result != ''
- name: Report error
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api -X PATCH -H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-f 'name=Estimator' \
-f 'head_sha=${{ github.event.pull_request.head.sha }}' \
-f 'conclusion=failure' \
-f 'output[title]=💥 Estimation failed' \
-f 'output[summary]=💥 Estimation failed' \
/repos/${{ github.repository }}/check-runs/${{ steps.check.outputs.check_id }}
if: steps.estimate.outputs.result == ''