Skip to content

feat: udf v2

feat: udf v2 #10086

Workflow file for this run

name: Report PR Age
on:
pull_request:
types:
- closed
jobs:
report-pr-age:
name: Report age of PR
runs-on: ubuntu-20.04
if: github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.merged == true
steps:
- name: Calculate PR age
run: |
pr_age=$((($(date '+%s') - $(date -d "${{ github.event.pull_request.created_at }}" '+%s'))))
echo pr_age=$pr_age >> $GITHUB_ENV
first_commit_message_in_pr=$(curl -s "${{github.event.pull_request._links.commits.href}}" | jq '.[0].commit.message')
echo first_commit_message_in_pr=$first_commit_message_in_pr >> $GITHUB_ENV
if [[ $first_commit_message_in_pr =~ Revert[[:space:]] ]]; then
echo is_revert=true >> $GITHUB_ENV
else
echo is_revert=false >> $GITHUB_ENV
fi
- name: Capture PR age to PostHog
uses: PostHog/[email protected]
with:
posthog-token: ${{secrets.POSTHOG_API_TOKEN}}
event: 'posthog-ci-pr-stats'
properties: '{"prAgeInSeconds": ${{ env.pr_age }}, "isRevert": ${{env.is_revert}}, "prTitle": "${{ github.event.pull_request.title}}", "prNumber": "${{ github.event.pull_request.number}}" }'