Skip to content

Generate license.json via GitHub Actions after deps updates (#38) #79

Generate license.json via GitHub Actions after deps updates (#38)

Generate license.json via GitHub Actions after deps updates (#38) #79

Workflow file for this run

name: General CI Workflow
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
jobs:
test-and-build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run tests
run: pnpm test
- name: Build the project
run: pnpm build
- name: Trigger Update Licenses Workflow
env:
PERSONAL_ACCESS_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
echo "Triggering Update Licenses Workflow for branch: ${{ github.ref_name }}"
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -X POST \
-H "Authorization: token ${PERSONAL_ACCESS_TOKEN}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/dispatches \
-d '{"event_type": "trigger-update-licenses", "client_payload": {"branch": "${{ github.ref_name }}"}}')
echo "Dispatch Event Response: $RESPONSE"
if [ "$RESPONSE" -ne 204 ]; then
echo "Failed to trigger the workflow"
exit 1
fi