chore(deps): bump actions/github-script from 7 to 8 #2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Tracking Issue | |
| on: | |
| issues: | |
| types: [opened, closed, reopened] | |
| pull_request: | |
| types: [opened, closed, reopened] | |
| jobs: | |
| update-tracking: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| pull-requests: read | |
| steps: | |
| - name: Update tracking issue | |
| uses: actions/github-script@v8 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const trackingIssueNumber = 52; | |
| // Get event details | |
| const { action, number } = context.payload; | |
| const isIssue = context.eventName === 'issues'; | |
| const item = context.payload[isIssue ? 'issue' : 'pull_request']; | |
| const type = isIssue ? 'Issue' : 'PR'; | |
| const state = item.state; | |
| const title = item.title; | |
| const createdAt = new Date(item.created_at).toISOString().split('T')[0]; | |
| // Format status emoji | |
| const statusEmoji = state === 'open' ? '🔄' : | |
| state === 'closed' && !isIssue ? '❌' : | |
| state === 'merged' ? '🎉' : '✅'; | |
| // Create update message | |
| const updateMsg = `## 🤖 Automated Update | |
| **${type} #${number}** - ${action} | |
| - **Title**: ${title} | |
| - **Status**: ${statusEmoji} ${state.toUpperCase()} | |
| - **Date**: ${createdAt} | |
| - **Action**: ${action} | |
| *This tracking issue will be manually updated with full context periodically.*`; | |
| // Add comment to tracking issue | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: trackingIssueNumber, | |
| body: updateMsg | |
| }); |