Skip to content

Commit 22e2d17

Browse files
committed
feat: add issue label trigger to daily check workflow
1 parent 6f8dbad commit 22e2d17

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/daily-check.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ name: "Daily Package Sync Checker"
33
on:
44
schedule:
55
- cron: "0 0 * * *" # Run daily at midnight UTC
6+
issues:
7+
types: [labeled]
68
workflow_dispatch: # Allow manual triggering
79

810
permissions:
@@ -11,6 +13,8 @@ permissions:
1113
jobs:
1214
check-packages:
1315
runs-on: ubuntu-latest
16+
# Skip if this is triggered by a label that's not 'package-broken' or 'package-missing'
17+
if: ${{ github.event_name != 'issues' || contains(github.event.label.name, 'package-broken') || contains(github.event.label.name, 'package-missing') }}
1418

1519
steps:
1620
- name: Check out repository
@@ -27,6 +31,12 @@ jobs:
2731
echo "Current branch: $(git branch --show-current)"
2832
echo "GitHub Actor: ${{ github.actor }}"
2933
echo "GitHub Repository: ${{ github.repository }}"
34+
echo "Trigger event: ${{ github.event_name }}"
35+
if [[ "${{ github.event_name }}" == "issues" ]]; then
36+
echo "Issue number: ${{ github.event.issue.number }}"
37+
echo "Issue title: ${{ github.event.issue.title }}"
38+
echo "Label: ${{ github.event.label.name }}"
39+
fi
3040
3141
- name: Set up Python
3242
uses: actions/setup-python@v4
@@ -42,3 +52,16 @@ jobs:
4252
python scripts/daily_check.py
4353
env:
4454
GH_PAT: ${{ secrets.GH_PAT }}
55+
56+
- name: Comment on issue if triggered by label
57+
if: ${{ github.event_name == 'issues' }}
58+
uses: actions/github-script@v6
59+
with:
60+
github-token: ${{ secrets.GH_PAT }}
61+
script: |
62+
github.rest.issues.createComment({
63+
issue_number: context.payload.issue.number,
64+
owner: context.repo.owner,
65+
repo: context.repo.repo,
66+
body: 'Package validity check has been run based on this issue label. The registry has been updated if any changes were detected.'
67+
})

0 commit comments

Comments
 (0)