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