Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 0 additions & 73 deletions .github/workflows/notify.yml

This file was deleted.

80 changes: 80 additions & 0 deletions .github/workflows/pr-validation.yml
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
28 changes: 13 additions & 15 deletions .github/workflows/test-notify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,22 @@ permissions:
jobs:
test-notify:
name: Test Notification
uses: ./.github/workflows/notify.yml
with:
message: ${{ inputs.message }}
msg_type: ${{ inputs.msg_type }}
title: ${{ inputs.title }}
secrets:
FEISHU_WEBHOOK_URL: ${{ secrets.FEISHU_WEBHOOK_URL }}

show-result:
name: Show Result
needs: test-notify
runs-on: ubuntu-latest
if: always()
steps:
- id: notification
uses: ./ # Uses action.yml from the current repository
with:
message: ${{ inputs.message }}
msg_type: ${{ inputs.msg_type }}
title: ${{ inputs.title }}
env:
FEISHU_WEBHOOK_URL: ${{ secrets.FEISHU_WEBHOOK_URL }}

Comment on lines 32 to +41
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n .github/workflows/test-notify.yml

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:

- uses: ./.github/actions/my-action

GitHub Actions looks for action.yml/action.yaml (or a Dockerfile) on disk under $GITHUB_WORKSPACE at 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

  1. Yes—local actions require the repo contents to be available, so you typically need a checkout step first: (docs.github.com)

    - uses: actions/checkout@v5
    - uses: ./.github/actions/my-action
  2. 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)

    - uses: actions/checkout@v5
      with:
        path: main
    - uses: ./main/.github/actions/my-action
  3. You can’t build the uses: path from env (it must be a static string in workflow YAML), so the workaround is to use a fixed checkout path (like main) or checkout to the default workspace. (stackoverflow.com)

Citations:


Local action requires repository checkout.

uses: ./ needs the repo contents in the workspace; without actions/checkout, this step will fail to locate action.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
In @.github/workflows/test-notify.yml around lines 32 - 41, The workflow's
local-action step (id: notification, uses: ./) will fail without checking out
the repository; add a preceding step that runs actions/checkout@v4 (or latest)
before the notification step so the workspace contains action.yml and other
files referenced by the local action; ensure the checkout step appears above the
step with id "notification" and retains any required permissions/checkout
settings for the action to run.

- name: Display notification result
if: always()
run: |
echo "### Notification Result" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **Status**: ${{ needs.test-notify.outputs.status }}" >> $GITHUB_STEP_SUMMARY
echo "- **Timestamp**: ${{ needs.test-notify.outputs.timestamp }}" >> $GITHUB_STEP_SUMMARY
echo "- **Response**: ${{ needs.test-notify.outputs.response }}" >> $GITHUB_STEP_SUMMARY
echo "- **Status**: ${{ steps.notification.outputs.status }}" >> $GITHUB_STEP_SUMMARY
echo "- **Timestamp**: ${{ steps.notification.outputs.timestamp }}" >> $GITHUB_STEP_SUMMARY
echo "- **Response**: ${{ steps.notification.outputs.response }}" >> $GITHUB_STEP_SUMMARY
49 changes: 49 additions & 0 deletions CHANGELOG.md
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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Changelog date appears one year behind.
Given this PR’s timestamp (2026‑02‑09), the release date likely needs updating.

📅 Suggested fix
-## [1.0.0] - 2025-02-09
+## [1.0.0] - 2026-02-09
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## [1.0.0] - 2025-02-09
## [1.0.0] - 2026-02-09
🤖 Prompt for AI Agents
In `@CHANGELOG.md` at line 5, Update the release date in the CHANGELOG entry for
version header "## [1.0.0] - 2025-02-09" to the correct 2026-02-09 (or the PR
timestamp) so the changelog matches the PR date; locate the "## [1.0.0] -
2025-02-09" line and replace the year 2025 with 2026.


### 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.
Loading