Skip to content

DS-77 Headless Checkbox #26

DS-77 Headless Checkbox

DS-77 Headless Checkbox #26

name: 🔄 Sync Comments To Linear
on:
issue_comment:
types: [created]
jobs:
check-pr:
name: 🔍 Check PR
if: >
github.event.issue.pull_request &&
!contains(github.event.comment.user.login, '[bot]') &&
github.event.comment.user.type != 'Bot' &&
github.actor != 'dependabot[bot]' &&
github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest
outputs:
is_release_pr: ${{ steps.check-pr-title.outputs.is_release_pr }}
comment_author: ${{ github.event.comment.user.login }}
comment_author_profile: ${{ github.event.comment.user.html_url }}
steps:
- name: 🔍 Check PR Title
id: check-pr-title
run: |
PR_TITLE="${{ github.event.issue.title }}"
if [[ $PR_TITLE == *"Release QDS"* ]]; then
echo "is_release_pr=true" >> $GITHUB_OUTPUT
else
echo "is_release_pr=false" >> $GITHUB_OUTPUT
fi
shell: bash
sync-comments:
name: 🔄 Sync Comments
needs: check-pr
if: needs.check-pr.outputs.is_release_pr == 'true'
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 🟢 Setup node
uses: actions/setup-node@v3
with:
node-version: "lts/*"
- name: 🥡 Setup pnpm
uses: pnpm/action-setup@v2
with:
version: latest
run_install: false
- name: 🎈 Get pnpm store directory
id: get-pnpm-cache-dir
run: |
echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
- name: 🔆 Cache pnpm
uses: actions/cache@v3
id: pnpm-cache
with:
path: ${{ steps.get-pnpm-cache-dir.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: 🧩 Install Dependencies
run: pnpm install
- name: 🏃‍♂️ Run Sync Script
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMENT_BODY: ${{ github.event.comment.body }}
LINEAR_API_KEY: ${{ secrets.LINEAR_API_KEY }}
PR_TITLE: ${{ github.event.issue.title }}
COMMENT_AUTHOR: ${{ needs.check-pr.outputs.comment_author }}
COMMENT_AUTHOR_PROFILE: ${{ needs.check-pr.outputs.comment_author_profile }}
run: pnpm vite-node .github/scripts/sync-pr-to-linear.ts