Skip to content
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

Test #2

Closed
wants to merge 39 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5ef37ed
test
iamwen1023 Oct 24, 2024
c40135a
test
iamwen1023 Oct 24, 2024
e662fca
version
iamwen1023 Oct 24, 2024
8ca8a6d
Delete .secrets
iamwen1023 Oct 24, 2024
77e0820
test
iamwen1023 Oct 24, 2024
a6eee9e
Merge branch 'test' of github.com:heal-dev/trigger into test
iamwen1023 Oct 24, 2024
39cb4e0
rewrite
iamwen1023 Oct 24, 2024
339cd0b
rewrite
iamwen1023 Oct 24, 2024
817eb6f
rebuild
iamwen1023 Oct 25, 2024
9afb357
rebuild
iamwen1023 Oct 25, 2024
736f4f4
comment
iamwen1023 Oct 25, 2024
b2bb126
Apply suggestions from code review
vdeturckheim Oct 25, 2024
4e6c596
Update babel.config.js
vdeturckheim Oct 25, 2024
0445483
Merge branch 'test' of github.com:heal-dev/trigger into test
iamwen1023 Oct 25, 2024
ef81581
add link in comment
iamwen1023 Oct 25, 2024
1a1679b
gittoken
iamwen1023 Oct 25, 2024
bda9891
summary
iamwen1023 Oct 25, 2024
e811287
summary
iamwen1023 Oct 25, 2024
facaec3
summary
iamwen1023 Oct 25, 2024
0ac6301
forget build
iamwen1023 Oct 25, 2024
6075b9b
forget build
iamwen1023 Oct 25, 2024
cf3b960
context.token
iamwen1023 Oct 25, 2024
b8b1cb3
summary
iamwen1023 Oct 25, 2024
f3cd350
summary
iamwen1023 Oct 25, 2024
e0b4819
summary1
iamwen1023 Oct 25, 2024
8239d50
summary1
iamwen1023 Oct 25, 2024
b396451
summary2
iamwen1023 Oct 25, 2024
856ffce
summary using add link directly
iamwen1023 Oct 25, 2024
89395c0
summary using add link directly try
iamwen1023 Oct 25, 2024
311e541
summary using add link directly try
iamwen1023 Oct 25, 2024
de862a4
summary using add link directly try
iamwen1023 Oct 25, 2024
1e9aa3c
miss ;
iamwen1023 Oct 25, 2024
17ee21b
miss ;
iamwen1023 Oct 25, 2024
497085f
test
iamwen1023 Oct 25, 2024
6691d76
whyyyyy?
iamwen1023 Oct 25, 2024
22b1ba5
good?
iamwen1023 Oct 25, 2024
25bfe37
good?
iamwen1023 Oct 25, 2024
07c9686
try composite
iamwen1023 Oct 25, 2024
c27510b
test not work
iamwen1023 Oct 27, 2024
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
37 changes: 37 additions & 0 deletions .github/workflows/test-action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Test Action

on:
workflow_dispatch:
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22

- name: Run Action
id: my-action
uses: ./
with:
api-token: ${{ secrets.HEAL_API_TOKEN }}
suite-id: "455"
wait-for-results: "yes"
domain: "https://api-staging.heal.dev"
comment-on-pr: "yes"

- name: Assert Result
run: |
if [[ "${{ steps.my-action.outputs.execution-id }}" == "" ]]; then
echo "Action failed to return an execution ID."
exit 1
fi
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
.secrets
78 changes: 78 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# Trigger

This GitHub Action triggers a test suite execution on Heal.dev directly from your continuous integration (CI) workflow. With this action, you can seamlessly integrate Heal's testing capabilities into your development process, ensuring that your applications are thoroughly tested and results are available right in your pull requests.

## Usage

To use the **Heal Trigger Action** in your GitHub workflow, include the following configuration in your workflow YAML file:

```yaml
- name: Trigger Heal Suite Execution
uses: heal-dev/trigger@main
with:
api-token: ${{ secrets.HEAL_API_TOKEN }} # Required: Your Heal API token.
suite-id: '443' # Required: The ID of the test suite.
payload: # Optional: JSON payload for the action.
{
"stories": [
{
"id": 5053,
"entryHref": "${{ url }}"
}
]
}
wait-for-results: 'yes' # Optional: Wait for results (default: 'yes').
domain: 'https://api.heal.dev' # Optional
comment-on-pr: 'yes' # Optional: Whether to comment test results on PRs (default: 'no').
```

## Inputs

| Input | Required | Description |
|--------------------|----------|------------------------------------------------------- |
| `api-token` | ✅ | Your Heal API token. |
| `suite-id` | ✅ | The ID of the test suite. |
| `payload` | ❌ | Optional. If empty, all stories under the suite will be run.|
| `wait-for-results` | ❌ | Whether to wait for results (default: `yes`). |
| `domain` | ❌ | (default: `https://api.heal.dev`). |
| `comment-on-pr` | ❌ | Whether to comment test results on PR (default: `no`). |


## Example

Here is a complete example of a GitHub Actions workflow that triggers the Heal test suite execution:

```yaml
name: Heal Test Workflow

on:
pull_request: # Trigger the workflow on pull requests.
branches:
- main # Adjust to your branch names.

jobs:
heal-test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Trigger Heal Suite Execution
uses: heal-dev/trigger@main
with:
api-token: ${{ secrets.HEAL_API_TOKEN }} # Required: Your Heal API token.
suite-id: '443' # Required: The ID of the test suite.
payload: # Optional: JSON payload for the action.
{
"stories": [
{
"id": 5053,
"entryHref": "${{ url }}"
}
]
}
wait-for-results: 'yes' # Optional: Wait for results (default: 'yes').
domain: 'https://api.heal.dev' # Optional
comment-on-pr: 'yes' # Optional: Whether to comment test results on PRs (default: 'no').

```
34 changes: 22 additions & 12 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
name: 'Heal Trigger Action'
description: 'Trigger a Heal suite execution and optionally wait for results'
name: "Heal Trigger Action"
description: "Trigger a Heal suite execution and optionally wait for results"
author: "Heal.dev"

inputs:
api-token:
description: 'Heal API token'
description: "Heal API token"
required: true
suite-id:
description: 'Suite ID to trigger'
description: "Suite ID to trigger"
required: true
payload:
description: 'Optional payload in JSON format'
description: "Optional payload in JSON format"
required: false
default: '{}'
default: "{}"
wait-for-results:
description: 'Wait for the execution to finish (yes/no)'
description: "Wait for the execution to finish (yes/no)"
required: false
default: 'yes'
default: "yes"
domain:
description: 'Domain for Heal API (default: https://app.heal.dev)'
description: "Domain for Heal API (default: https://app.heal.dev)"
required: false
default: 'https://app.heal.dev'
default: "https://app.heal.dev"
github-token:
description: The GitHub token used to post comments on pull requests
default: ${{ github.token }}
comment-on-pr:
description: "Whether to comment test results on PR (yes/no)"
required: false
default: "no"

runs:
using: 'node16'
main: 'dist/index.js'
using: "node20"
main: "dist/index.js"
5 changes: 5 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default {
presets: [
['@babel/preset-env', { targets: { node: 'current' } }],
],
};
35 changes: 35 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { build } from 'esbuild';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const buildAction = async () => {
try {
await build({
entryPoints: [join(__dirname, 'src', 'index.js')],
bundle: true,
platform: 'node',
target: 'node20',
format: 'esm',
outfile: join(__dirname, 'dist', 'index.js'),
sourcemap: true,
minify: true,
banner: {
js: `
export const require = (await import("node:module")).createRequire(import.meta.url);
export const __filename = '${__filename}';
export const __dirname = '${__dirname}';
`,
},
});
console.log('Build completed successfully!');
} catch (error) {
console.error('Build failed:', error);
process.exit(1);
}
};

// Run the build process
buildAction();
Loading
Loading