Skip to content

Commit 9987df1

Browse files
committed
[FEATURE] set up tests to validate imports work for all app
1 parent 752939a commit 9987df1

File tree

10 files changed

+1227
-9
lines changed

10 files changed

+1227
-9
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules/
2+
*.log
3+
.DS_Store
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
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+
```
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: 'Create Package Validation Issue'
2+
description: 'Creates or updates GitHub issues when package validation failures are detected'
3+
inputs:
4+
github-token:
5+
description: 'GitHub token for creating issues'
6+
required: true
7+
validation-report-json:
8+
description: 'Path to the JSON validation report file'
9+
required: true
10+
default: 'validation-report.json'
11+
validation-report-txt:
12+
description: 'Path to the text validation report file'
13+
required: false
14+
default: 'validation-report.txt'
15+
workflow-run-number:
16+
description: 'GitHub workflow run number'
17+
required: true
18+
workflow-run-id:
19+
description: 'GitHub workflow run ID'
20+
required: true
21+
server-url:
22+
description: 'GitHub server URL'
23+
required: true
24+
repository:
25+
description: 'Repository name in owner/repo format'
26+
required: true
27+
28+
runs:
29+
using: 'composite'
30+
steps:
31+
- name: Setup Node.js for action
32+
uses: actions/setup-node@v4.0.3
33+
with:
34+
node-version: '20'
35+
36+
- name: Install action dependencies
37+
shell: bash
38+
run: |
39+
cd ${{ github.action_path }}
40+
npm install
41+
42+
- name: Run issue creation
43+
shell: bash
44+
run: |
45+
cd ${{ github.action_path }}
46+
node src/index.js
47+
env:
48+
INPUT_GITHUB_TOKEN: ${{ inputs.github-token }}
49+
INPUT_VALIDATION_REPORT_JSON: ${{ inputs.validation-report-json }}
50+
INPUT_VALIDATION_REPORT_TXT: ${{ inputs.validation-report-txt }}
51+
INPUT_WORKFLOW_RUN_NUMBER: ${{ inputs.workflow-run-number }}
52+
INPUT_WORKFLOW_RUN_ID: ${{ inputs.workflow-run-id }}
53+
INPUT_SERVER_URL: ${{ inputs.server-url }}
54+
INPUT_REPOSITORY: ${{ inputs.repository }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "create-package-validation-issue",
3+
"version": "1.0.0",
4+
"description": "GitHub Action to create or update issues for package validation failures",
5+
"main": "src/index.js",
6+
"scripts": {
7+
"test": "echo \"No tests yet\" && exit 0"
8+
},
9+
"dependencies": {
10+
"@actions/core": "^1.10.1",
11+
"@actions/github": "^6.0.0"
12+
},
13+
"keywords": [
14+
"github-action",
15+
"pipedream",
16+
"package-validation",
17+
"issues"
18+
],
19+
"author": "Pipedream",
20+
"license": "MIT"
21+
}

0 commit comments

Comments
 (0)