-
Notifications
You must be signed in to change notification settings - Fork 0
reuseable to action #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| name: PR Validation | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: [main] | ||
|
|
||
| jobs: | ||
| validate: | ||
| name: Validate TypeScript | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Build TypeScript | ||
| run: npm run build | ||
|
|
||
| - name: Test action execution | ||
| run: | | ||
| # Test with missing webhook (should return failure but not crash) | ||
| FEISHU_MESSAGE="Test message" HAGI_ACTION_MODE="true" npx tsx src/feishu.ts | ||
|
|
||
| - name: Verify package.json | ||
| run: | | ||
| # Verify tsx is in dependencies | ||
| if ! grep -q '"tsx"' package.json; then | ||
| echo "Error: tsx not found in package.json dependencies" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Verify build script exists | ||
| if ! grep -q '"build"' package.json; then | ||
| echo "Error: build script not found in package.json" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Verify action.yml | ||
| run: | | ||
| # Verify action.yml exists | ||
| if [ ! -f "action.yml" ]; then | ||
| echo "Error: action.yml not found" | ||
| exit 1 | ||
| fi | ||
|
|
||
| # Verify tsx is used in action.yml | ||
| if ! grep -q 'npx tsx src/feishu.ts' action.yml; then | ||
| echo "Error: action.yml doesn't use tsx for execution" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Verify source files | ||
| run: | | ||
| # Verify required source files exist | ||
| if [ ! -f "src/feishu.ts" ]; then | ||
| echo "Error: src/feishu.ts not found" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -f "src/types.ts" ]; then | ||
| echo "Error: src/types.ts not found" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ ! -f "src/index.ts" ]; then | ||
| echo "Error: src/index.ts not found" | ||
| exit 1 | ||
| fi | ||
|
|
||
| - name: Check TypeScript compilation | ||
| run: | | ||
| # Ensure no TypeScript errors | ||
| npx tsc --noEmit |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,49 @@ | ||||||
| # Changelog | ||||||
|
|
||||||
| All notable changes to this project will be documented in this file. | ||||||
|
|
||||||
| ## [1.0.0] - 2025-02-09 | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changelog date appears one year behind. 📅 Suggested fix-## [1.0.0] - 2025-02-09
+## [1.0.0] - 2026-02-09📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
|
|
||||||
| ### Added | ||||||
| - GitHub Composite Action (`action.yml`) for Feishu notifications | ||||||
| - Action mode support in `runCli()` to prevent action failures when notifications fail | ||||||
| - `tsx` as runtime dependency for direct TypeScript execution | ||||||
|
|
||||||
| ### Changed | ||||||
| - **BREAKING**: Converted from reusable workflow to composite action | ||||||
| - **BREAKING**: Updated usage syntax from `uses: ./.github/workflows/notify.yml@main` to `uses: HagiCode-org/haginotifier@v1` | ||||||
| - Secrets are now passed via `env:` instead of `secrets:` in workflow syntax | ||||||
| - Outputs are accessed via `steps.<step-id>.outputs.*` instead of `needs.<job-id>.outputs.*` | ||||||
|
|
||||||
| ### Removed | ||||||
| - Deprecated `.github/workflows/notify.yml` reusable workflow | ||||||
|
|
||||||
| ### Migration Guide | ||||||
|
|
||||||
| If you were using the old reusable workflow syntax, update your workflows: | ||||||
|
|
||||||
| **Old syntax:** | ||||||
| ```yaml | ||||||
| jobs: | ||||||
| notify: | ||||||
| uses: HagiCode-org/haginotifier/.github/workflows/notify.yml@main | ||||||
| with: | ||||||
| message: 'Deployment successful!' | ||||||
| secrets: | ||||||
| FEISHU_WEBHOOK_URL: ${{ secrets.FEISHU_WEBHOOK_URL }} | ||||||
| ``` | ||||||
|
|
||||||
| **New syntax:** | ||||||
| ```yaml | ||||||
| jobs: | ||||||
| notify: | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - uses: HagiCode-org/haginotifier@v1 | ||||||
| with: | ||||||
| message: 'Deployment successful!' | ||||||
| env: | ||||||
| FEISHU_WEBHOOK_URL: ${{ secrets.FEISHU_WEBHOOK_URL }} | ||||||
| ``` | ||||||
|
|
||||||
| See README.md for more details and examples. | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: HagiCode-org/haginotifier
Length of output: 1864
🌐 Web query:
GitHub Actions local action checkout requirement uses ./ action.yml💡 Result:
When you reference a local action like:
GitHub Actions looks for
action.yml/action.yaml(or aDockerfile) on disk under$GITHUB_WORKSPACEat that relative path. If the repository files aren’t present there yet, you’ll get the “Can’t find 'action.yml'… Did you forget to run actions/checkout” error. (docs.github.com)What this means in practice
Yes—local actions require the repo contents to be available, so you typically need a checkout step first: (docs.github.com)
If you checkout into a non-default folder using
with: path: ..., then your local action reference must include that folder (still relative to$GITHUB_WORKSPACE): (docs.github.com)You can’t build the
uses:path fromenv(it must be a static string in workflow YAML), so the workaround is to use a fixed checkout path (likemain) or checkout to the default workspace. (stackoverflow.com)Citations:
Local action requires repository checkout.
uses: ./needs the repo contents in the workspace; withoutactions/checkout, this step will fail to locateaction.yml.✅ Add checkout before using the local action
steps: + - uses: actions/checkout@v4 - id: notification uses: ./ # Uses action.yml from the current repository🤖 Prompt for AI Agents