Skip to content

WIP/POC/ci: trigger playwright workflow on another repo #433

WIP/POC/ci: trigger playwright workflow on another repo

WIP/POC/ci: trigger playwright workflow on another repo #433

Workflow file for this run

name: Build, Test, and Deploy
on: [pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set Node Version
uses: actions/setup-node@v4
with:
node-version: lts/iron
- name: Install
uses: bahmutov/npm-install@v1
- name: Build and package library
run: |
npm run package --if-present
env:
CI: true
- name: Format
run: |
npm run format:check --if-present
env:
CI: true
- name: Build
run: |
npm run build --if-present
env:
CI: true
- name: Test
run: |
npm run ci --if-present
env:
CI: true
- name: Trigger Repository Siemens Datatable Workflow
if: always() # Runs even if Test step fails
env:
PAT: ${{ secrets.PLAYWRIGHT }}
run: |
curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token $PAT" \
https://api.github.com/repos/chintankavathia/siemens-datatable/actions/workflows/test_and_deploy.yml/dispatches \
-d '{"ref":"main"}'
- name: Wait for Repository Siemens Datatable Workflow Completion
id: wait_workflow
env:
PAT: ${{ secrets.PLAYWRIGHT }}
run: |
STATUS="in_progress"
CHECK_INTERVAL=30
RUN_ID=""
echo "Polling for workflow status..."
while [ "$STATUS" = "in_progress" ] || [ "$STATUS" = "queued" ]; do
sleep $CHECK_INTERVAL
echo "Polling for workflow status...$STATUS"
# Fetch latest workflow runs for Repository B
RESPONSE=$(curl -s -H "Authorization: token $PAT" \
"https://api.github.com/repos/chintankavathia/siemens-datatable/actions/runs?branch=main&status=in_progress")
T_RUN_ID=$(echo $RESPONSE | jq -r '.workflow_runs[0].id')
STATUS=$(echo $RESPONSE | jq -r '.workflow_runs[0].status')
if [ "!$T_RUN_ID" ]; then
RUN_ID=$T_RUN_ID
fi
done
echo "Polling for workflow status...$RUN_ID"
CONCLUSION=$(curl -s -H "Authorization: token $PAT" \
"https://api.github.com/repos/chintankavathia/siemens-datatable/actions/runs/$RUN_ID" | jq -r '.conclusion')
echo "Conclusion:: $CONCLUSION"
if [ "$CONCLUSION" != "success" ]; then
echo "Repository Siemens Datatable workflow failed with conclusion: $CONCLUSION"
exit 1
fi
echo "Repository Siemens Datatable workflow completed successfully"
- name: Build Docs
run: |
npm run build-docs --if-present
env:
CI: true
- name: Deploy Docs
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: dist/ngx-datatable
if: ${{ github.ref == 'refs/heads/master' }}