{"id":29955116,"url":"https://github.com/phucbm/test-pr-action","last_synced_at":"2026-02-16T12:38:35.305Z","repository":{"id":302376995,"uuid":"1012242053","full_name":"phucbm/test-pr-action","owner":"phucbm","description":"Automatically test pull requests and optionally auto-merge Dependabot PRs when tests pass","archived":false,"fork":false,"pushed_at":"2025-07-03T13:03:50.000Z","size":13,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-15T21:06:36.349Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phucbm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-02T03:33:12.000Z","updated_at":"2025-09-06T01:59:21.000Z","dependencies_parsed_at":"2025-10-08T19:40:26.610Z","dependency_job_id":"55eb6494-2bf9-4049-bfbd-fc8c0145b093","html_url":"https://github.com/phucbm/test-pr-action","commit_stats":null,"previous_names":["phucbm/test-pr-action"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/phucbm/test-pr-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phucbm%2Ftest-pr-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phucbm%2Ftest-pr-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phucbm%2Ftest-pr-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phucbm%2Ftest-pr-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phucbm","download_url":"https://codeload.github.com/phucbm/test-pr-action/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phucbm%2Ftest-pr-action/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29507912,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-16T09:05:14.864Z","status":"ssl_error","status_checked_at":"2026-02-16T08:55:59.364Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-03T17:10:48.002Z","updated_at":"2026-02-16T12:38:35.288Z","avatar_url":"https://github.com/phucbm.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Test PR Action\n\n[![github stars](https://badgen.net/github/stars/phucbm/test-pr-action?icon=github)](https://github.com/phucbm/test-pr-action/)\n[![github license](https://badgen.net/github/license/phucbm/test-pr-action?icon=github)](https://github.com/phucbm/test-pr-action/blob/main/LICENSE)\n[![Made in Vietnam](https://raw.githubusercontent.com/webuild-community/badge/master/svg/made.svg)](https://webuild.community)\n\nA GitHub Action that automatically tests pull requests and optionally auto-merges Dependabot PRs when tests pass. Perfect for maintaining high code quality with minimal manual intervention.\n\n## Features\n```\n┌─────────────┐    ┌─────────────┐    ┌─────────────┐    ┌─────────────┐\n│   TRIGGER   │───▶│  DETECTION  │───▶│    TEST     │───▶│   ACTION    │\n└─────────────┘    └─────────────┘    └─────────────┘    └─────────────┘\n       │                   │                   │                   │\n       ▼                   ▼                   ▼                   ▼\n   PR created         Auto-detect pkg      Run tests if         Comment results\n   Comment command    manager \u0026 scripts    scripts exist        Auto-merge if\n   PR updated         Support npm/pnpm/    Skip if missing      Dependabot + pass\n                      yarn detection       Handle failures      Manual commands\n```\n\n## Quick Start\n\n1. **Create Workflow File**\n   Create `.github/workflows/test-pr.yml`:\n\n```yaml\nname: Test PRs\n\non:\n  pull_request:\n    types: [opened, synchronize]\n  issue_comment:\n    types: [created]\n\npermissions:\n  contents: write      # To auto-merge PRs\n  pull-requests: write # To comment on PRs\n  issues: write        # To comment on PRs\n\njobs:\n  test:\n    if: github.event_name == 'pull_request' || contains(github.event.comment.body, '/test')\n    runs-on: ubuntu-latest\n    steps:\n      - name: Test PR\n        uses: phucbm/test-pr-action@v1\n        with:\n          dependabot-auto-merge: 'true'  # Optional: auto-merge Dependabot PRs\n```\n\n2. **That's it!** 🎉\n   - All new PRs are automatically tested\n   - Results are commented directly on the PR\n   - Use `/test` commands for manual testing\n   - Dependabot PRs can be auto-merged when tests pass\n\n## Commands\n\nComment these commands on any PR to trigger actions:\n\n| Command | Description |\n|---------|-------------|\n| `/test` | Run tests and comment results |\n| `/retest` | Re-run tests and comment results |\n| `/test-merge` | Run tests and auto-merge if Dependabot PR passes |\n\n## Inputs\n\n| Input | Description | Required | Default |\n|-------|-------------|----------|---------|\n| `dependabot-auto-merge` | Auto-merge Dependabot PRs if tests pass | ❌ No | `false` |\n| `github-token` | GitHub token for commenting and merging | ❌ No | `${{ github.token }}` |\n| `node-version` | Node.js version to use | ❌ No | `18` |\n| `package-manager` | Package manager to use (npm, pnpm, yarn, auto) | ❌ No | `auto` |\n\n## Basic Usage\n\n**Minimal setup** (just test and comment):\n```yaml\n- name: Test PR\n  uses: phucbm/test-pr-action@v1\n```\n\n**With auto-merge** for Dependabot PRs:\n```yaml\n- name: Test PR\n  uses: phucbm/test-pr-action@v1\n  with:\n    dependabot-auto-merge: 'true'\n```\n\n## Advanced Usage\n\nAll available options:\n\n```yaml\n- name: Test PR\n  uses: phucbm/test-pr-action@v1\n  with:\n    dependabot-auto-merge: 'true'           # Auto-merge Dependabot PRs if tests pass\n    github-token: ${{ secrets.GITHUB_TOKEN }} # Custom GitHub token\n    node-version: '20'                      # Node.js version\n    package-manager: 'pnpm'                 # Force specific package manager\n```\n\n## How It Works\n\n```\n🎯 TRIGGER PHASE\n   └── Automatically on PR create/update\n   └── Manually via comment commands\n   └── Smart filtering for relevant events\n\n🔍 DETECTION PHASE  \n   └── Auto-detect package manager (npm/pnpm/yarn)\n   └── Check for test scripts in package.json\n   └── Identify Dependabot PRs for auto-merge\n\n🧪 TEST PHASE\n   └── Install dependencies with detected package manager\n   └── Run test scripts if they exist\n   └── Handle test failures gracefully\n   └── Skip tests if no script found\n\n💬 ACTION PHASE\n   └── Comment test results on PR\n   └── Include helpful command instructions\n   └── Auto-merge Dependabot PRs if configured\n   └── Provide clear success/failure feedback\n```\n\n## Comment Examples\n\n**Tests passed:**\n```\n✅ Tests passed! All tests completed successfully.\n\n---\nTest PR Action commands and options\n• /test will run tests and comment the results\n• /retest will re-run tests and comment the results  \n• /test-merge will run tests and auto-merge this Dependabot PR if tests pass\n\n💡 Tip: Auto-merge is currently enabled for Dependabot PRs.\n```\n\n**Tests failed:**\n```\n❌ Tests failed! Please check the workflow logs for details.\n\n---\nTest PR Action commands and options\n• /test will run tests and comment the results\n• /retest will re-run tests and comment the results\n\n💡 Tip: Fix the failing tests and use /retest to verify the fixes.\n```\n\n**No tests:**\n```\nℹ️ No test script found in package.json. Skipping tests.\n\n---\nTest PR Action commands and options\n• /test will check for tests and comment the results\n\n💡 Tip: Add a test script to your package.json to enable automatic testing.\n```\n\n## Package Manager Support\n\nThe action automatically detects your package manager:\n\n| Package Manager | Detection Method | Install Command | Test Command |\n|----------------|------------------|-----------------|--------------|\n| **PNPM** | `pnpm-lock.yaml` exists | `pnpm install --no-frozen-lockfile` | `pnpm test` |\n| **Yarn** | `yarn.lock` exists | `yarn install --no-immutable` | `yarn test` |\n| **NPM** | Default fallback | `npm ci` | `npm test` |\n\nYou can also force a specific package manager using the `package-manager` input.\n\n## Workflow Examples\n\n**Basic testing for all PRs:**\n```yaml\nname: Test PRs\non:\n  pull_request:\n    types: [opened, synchronize]\n  issue_comment:\n    types: [created]\n\njobs:\n  test:\n    if: github.event_name == 'pull_request' || contains(github.event.comment.body, '/test')\n    runs-on: ubuntu-latest\n    steps:\n      - uses: phucbm/test-pr-action@v1\n```\n\n**Auto-merge Dependabot PRs:**\n```yaml\nname: Test and Auto-merge\non:\n  pull_request:\n    types: [opened, synchronize]\n  issue_comment:\n    types: [created]\n\npermissions:\n  contents: write\n  pull-requests: write\n  issues: write\n\njobs:\n  test:\n    if: github.event_name == 'pull_request' || contains(github.event.comment.body, '/test')\n    runs-on: ubuntu-latest\n    steps:\n      - uses: phucbm/test-pr-action@v1\n        with:\n          dependabot-auto-merge: 'true'\n```\n\n**Using with different Node.js versions:**\n```yaml\nstrategy:\n  matrix:\n    node-version: [16, 18, 20]\n\nsteps:\n  - uses: phucbm/test-pr-action@v1\n    with:\n      node-version: ${{ matrix.node-version }}\n```\n\n## Requirements\n\n- Repository must have a `package.json` file for Node.js projects\n- Test scripts should be defined in `package.json` (optional)\n- Workflow must have appropriate permissions for commenting and merging\n\n## Troubleshooting\n\n**Action doesn't trigger on comments**\n- Ensure your workflow includes `issue_comment` trigger\n- Check that the comment contains `/test`, `/retest`, or `/test-merge`\n\n**Auto-merge not working**\n- Verify `dependabot-auto-merge: 'true'` is set\n- Check that workflow has `contents: write` permission\n- Ensure the PR is created by `dependabot[bot]`\n\n**Tests not running**\n- Verify you have a `test` script in `package.json`\n- Check the workflow logs for package manager detection\n- Try using `/test` command to manually trigger\n\n**Permission denied**\n- Ensure workflow has required permissions:\n  ```yaml\n  permissions:\n    contents: write\n    pull-requests: write\n    issues: write\n  ```\n\n## Best Practices\n\n1. **Use with Dependabot** for automatic dependency management\n2. **Enable auto-merge** for trusted dependency updates\n3. **Add comprehensive tests** to your package.json\n4. **Monitor workflow logs** for any issues\n5. **Use comment commands** for manual testing when needed\n\n## License\n\nMIT License - feel free to use in your projects!\n\n## Contributing\n\nIssues and pull requests welcome! This action is designed to be simple, reliable, and helpful for all JavaScript/TypeScript projects.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphucbm%2Ftest-pr-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphucbm%2Ftest-pr-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphucbm%2Ftest-pr-action/lists"}