|
| 1 | +# Create Package Validation Issue Action |
| 2 | + |
| 3 | +This GitHub Action creates or updates issues when package validation failures are detected in the Pipedream repository. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- ✅ **Smart Issue Management**: Creates new issues or updates existing ones for the same day |
| 8 | +- 📊 **Rich Reporting**: Includes detailed summaries, failure categories, and quick action commands |
| 9 | +- 🔄 **Fallback Support**: Works with both JSON and text validation reports |
| 10 | +- 🏷️ **Auto-labeling**: Automatically applies appropriate labels for organization |
| 11 | +- 📈 **Failure Analysis**: Groups failures by category for easier debugging |
| 12 | + |
| 13 | +## Inputs |
| 14 | + |
| 15 | +| Input | Description | Required | Default | |
| 16 | +|-------|-------------|----------|---------| |
| 17 | +| `github-token` | GitHub token for API access | ✅ | - | |
| 18 | +| `validation-report-json` | Path to JSON validation report | ✅ | `validation-report.json` | |
| 19 | +| `validation-report-txt` | Path to text validation report | ❌ | `validation-report.txt` | |
| 20 | +| `workflow-run-number` | GitHub workflow run number | ✅ | - | |
| 21 | +| `workflow-run-id` | GitHub workflow run ID | ✅ | - | |
| 22 | +| `server-url` | GitHub server URL | ✅ | - | |
| 23 | +| `repository` | Repository name (owner/repo) | ✅ | - | |
| 24 | + |
| 25 | +## Outputs |
| 26 | + |
| 27 | +| Output | Description | Example | |
| 28 | +|--------|-------------|---------| |
| 29 | +| `issue-created` | Whether a new issue was created | `true`/`false` | |
| 30 | +| `issue-updated` | Whether an existing issue was updated | `true`/`false` | |
| 31 | +| `issue-url` | URL of the created/updated issue | `https://github.com/...` | |
| 32 | +| `failed-count` | Number of failed packages | `42` | |
| 33 | + |
| 34 | +## Usage |
| 35 | + |
| 36 | +```yaml |
| 37 | +- name: Create Issue on Failures |
| 38 | + if: steps.check_failures.outputs.failed_count != '0' |
| 39 | + uses: ./.github/actions/create-package-validation-issue |
| 40 | + with: |
| 41 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 42 | + validation-report-json: 'validation-report.json' |
| 43 | + validation-report-txt: 'validation-report.txt' # optional |
| 44 | + workflow-run-number: ${{ github.run_number }} |
| 45 | + workflow-run-id: ${{ github.run_id }} |
| 46 | + server-url: ${{ github.server_url }} |
| 47 | + repository: ${{ github.repository }} |
| 48 | +``` |
| 49 | +
|
| 50 | +## Issue Format |
| 51 | +
|
| 52 | +The action creates issues with: |
| 53 | +
|
| 54 | +### 📦 Title Format |
| 55 | +``` |
| 56 | +📦 Package Validation Report - [Date] - [X] failures |
| 57 | +``` |
| 58 | + |
| 59 | +### 📋 Content Sections |
| 60 | +1. **Summary**: Overview statistics of validation results |
| 61 | +2. **Links**: Direct links to workflow run and artifacts |
| 62 | +3. **Failed Packages**: List of top failing packages with error types |
| 63 | +4. **Failure Categories**: Grouped failures by validation type |
| 64 | +5. **Next Steps**: Action items for developers |
| 65 | +6. **Quick Commands**: Copy-paste commands for local testing |
| 66 | + |
| 67 | +### 🏷️ Auto-applied Labels |
| 68 | +- `package-validation`: Identifies validation-related issues |
| 69 | +- `automated`: Marks as automatically created |
| 70 | +- `bug`: Indicates packages needing fixes |
| 71 | + |
| 72 | +## Behavior |
| 73 | + |
| 74 | +### New Issues |
| 75 | +- Creates a new issue if no open validation issue exists for the current date |
| 76 | +- Applies appropriate labels automatically |
| 77 | + |
| 78 | +### Existing Issues |
| 79 | +- Updates existing issues with new validation results as comments |
| 80 | +- Avoids creating duplicate issues for the same day |
| 81 | +- Maintains issue history through comments |
| 82 | + |
| 83 | +### No Failures |
| 84 | +- Skips issue creation when no validation failures are detected |
| 85 | +- Sets output flags appropriately for workflow logic |
| 86 | + |
| 87 | +## Error Handling |
| 88 | + |
| 89 | +- **JSON Parse Errors**: Falls back to text report parsing |
| 90 | +- **Missing Files**: Gracefully handles missing report files |
| 91 | +- **API Failures**: Provides detailed error messages for debugging |
| 92 | +- **Network Issues**: Fails gracefully with actionable error messages |
| 93 | + |
| 94 | +## Development |
| 95 | + |
| 96 | +### Local Testing |
| 97 | +```bash |
| 98 | +# Install dependencies |
| 99 | +cd .github/actions/create-package-validation-issue |
| 100 | +npm install |
| 101 | + |
| 102 | +# Test with sample data |
| 103 | +node test/test-action.js |
| 104 | +``` |
| 105 | + |
| 106 | +### Dependencies |
| 107 | +- `@actions/core`: GitHub Actions toolkit for inputs/outputs |
| 108 | +- `@actions/github`: GitHub API client and context |
| 109 | + |
| 110 | +### Technical Notes |
| 111 | +- **Composite Action**: Uses `composite` action type to handle dependency installation automatically |
| 112 | +- **Auto-Install**: Dependencies are installed during action execution for reliability |
| 113 | +- **Path Resolution**: File paths are resolved relative to the GitHub workspace |
| 114 | +- **Fallback Support**: Gracefully handles missing files and parse errors |
| 115 | + |
| 116 | +## Integration |
| 117 | + |
| 118 | +This action is designed to work with: |
| 119 | +- `scripts/generate-package-report.js`: Validation report generator |
| 120 | +- `.github/workflows/daily-package-validation.yaml`: Daily validation workflow |
| 121 | +- Pipedream component validation pipeline |
| 122 | + |
| 123 | +## Example Issue Output |
| 124 | + |
| 125 | +```markdown |
| 126 | +# 📦 Daily Package Validation Report - Mon Jan 15 2024 |
| 127 | + |
| 128 | +📊 **Summary:** |
| 129 | +- Total Components: 2932 |
| 130 | +- ✅ Validated: 2847 |
| 131 | +- ❌ Failed: 85 |
| 132 | +- ⏭️ Skipped: 1250 |
| 133 | +- 📈 Publishable: 2932 |
| 134 | +- 📉 Failure Rate: 2.90% |
| 135 | + |
| 136 | +## 🔗 Links |
| 137 | +- **Workflow Run**: [#123](https://github.com/org/repo/actions/runs/456) |
| 138 | +- **Download Reports**: Check the workflow artifacts for detailed reports |
| 139 | + |
| 140 | +## ❌ Failed Packages |
| 141 | +- **@pipedream/netlify** (netlify): import, dependencies |
| 142 | +- **@pipedream/google-slides** (google_slides): mainFile |
| 143 | +- ... and 83 more packages |
| 144 | + |
| 145 | +## Next Steps |
| 146 | +1. Review the failed packages listed above |
| 147 | +2. Check the full validation report artifact |
| 148 | +3. Fix import/dependency issues in failing packages |
| 149 | +... |
| 150 | +``` |
0 commit comments