feat: add direct pull request trigger to artifact comment workflow

Enables the workflow to run directly on pull request events (opened, synchronize, reopened) in addition to the existing workflow_run and manual dispatch triggers.

Provides immediate status updates in PR checks and improves user experience by showing workflow progress directly in the pull request interface rather than only after completion of upstream workflows.
This commit is contained in:
Uruk
2025-09-30 00:01:15 +02:00
parent 0d1aeaf8aa
commit 4f6863f317

View File

@@ -6,6 +6,8 @@ concurrency:
on:
workflow_dispatch: # Allow manual testing
pull_request: # Show in PR checks and provide status updates
types: [opened, synchronize, reopened]
workflow_run:
workflows:
- "🤖 Android APK Build (Phone + TV)"
@@ -16,7 +18,7 @@ on:
jobs:
comment-artifacts:
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request')
if: github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' || (github.event_name == 'workflow_run' && github.event.workflow_run.event == 'pull_request')
runs-on: ubuntu-latest
permissions:
contents: read
@@ -28,7 +30,7 @@ jobs:
uses: actions/github-script@v8
with:
script: |
// Handle both workflow_run and manual dispatch events
// Handle workflow_run, pull_request, and manual dispatch events
let pr;
if (context.eventName === 'workflow_run') {
@@ -45,6 +47,10 @@ jobs:
}
pr = pullRequests[0];
} else if (context.eventName === 'pull_request') {
// Direct PR event
pr = context.payload.pull_request;
} else if (context.eventName === 'workflow_dispatch') {
// Get current PR for manual testing
const prNumber = context.payload.pull_request?.number || 1101;