Skip to content

Commit 1751282

Browse files
janbucharbarjinvladfrangu
authored
feat: Add execute-workflow action (#228)
* feat: Add execute-workflow action * Use correct token * Update readme * Vlad requests semicolons * Reformat * Update versions of stuff * Rebuild bundle * Rebuild js bundles on commit to main * Update .github/workflows/check-execute-workflow-dist.yaml Co-authored-by: Jindřich Bär <[email protected]> * Update .github/workflows/check-execute-workflow-dist.yaml Co-authored-by: Vlad Frangu <[email protected]> * Minify the bundle --------- Co-authored-by: Jindřich Bär <[email protected]> Co-authored-by: Vlad Frangu <[email protected]>
1 parent 1d979a3 commit 1751282

File tree

11 files changed

+2241
-0
lines changed

11 files changed

+2241
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Check and Update dist in js actions
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'execute-workflow/**'
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
check-and-update-dist:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v5
20+
with:
21+
token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v6
25+
with:
26+
node-version: '24'
27+
cache: 'npm'
28+
cache-dependency-path: execute-workflow/package-lock.json
29+
30+
- name: Install dependencies
31+
working-directory: execute-workflow
32+
run: npm ci
33+
34+
- name: Rebuild dist
35+
working-directory: execute-workflow
36+
run: npm run build
37+
38+
- name: Commit and push if changed
39+
uses: EndBug/add-and-commit@v9
40+
with:
41+
author_name: Apify Release Bot
42+
author_email: [email protected]
43+
message: "chore: rebuild execute-workflow dist [skip ci]"
44+
add: 'execute-workflow/dist/'

execute-workflow/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
.env

execute-workflow/.prettierrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"semi": true,
3+
"singleQuote": true,
4+
"printWidth": 120
5+
}

execute-workflow/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Execute Workflow Action
2+
3+
A GitHub Action for triggering workflows via `workflow_dispatch`, waiting for them to complete, and reporting their results.
4+
5+
- Triggers workflows using the `workflow_dispatch` event
6+
- Waits for the workflow run to start (up to 60 seconds)
7+
- Polls the workflow run status until completion
8+
- Outputs the workflow run ID and conclusion
9+
- Fails the action if the triggered workflow doesn't succeed
10+
11+
## Usage
12+
13+
```yaml
14+
- name: Execute workflow
15+
uses: ./execute-workflow
16+
with:
17+
workflow: my-workflow.yaml
18+
inputs: '{ "key": "value" }'
19+
```
20+
21+
## Inputs
22+
23+
- `workflow` (required): Workflow filename relative to `.github/workflows` (e.g., `my-workflow.yaml`)
24+
- `inputs` (optional): Inputs to pass to the workflow as a JSON string
25+
- `token` (optional): GitHub token for authentication (defaults to `${{ github.token }}`)
26+
27+
## Outputs
28+
29+
- `workflowRunId`: The ID of the triggered workflow run
30+
- `conclusion`: The conclusion of the workflow run (`success`, `failure`, `cancelled`, etc.)

execute-workflow/action.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: 'Execute Workflow'
2+
description: 'Execute GitHub Actions workflows and wait for them to complete'
3+
4+
inputs:
5+
workflow:
6+
description: "Workflow filename relative to .github/workflows (e.g., 'my-workflow.yaml')"
7+
required: true
8+
inputs:
9+
description: 'Inputs to pass to the workflow, must be a JSON string'
10+
required: false
11+
token:
12+
description: 'GitHub token for authentication'
13+
required: false
14+
default: ${{ github.token }}
15+
16+
runs:
17+
using: 'node24'
18+
main: 'dist/index.js'

execute-workflow/dist/index.js

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

execute-workflow/eslint.config.mjs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// @ts-check
2+
3+
import eslint from '@eslint/js'
4+
import tseslint from 'typescript-eslint'
5+
6+
export default tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended, ...tseslint.configs.strict)

0 commit comments

Comments
 (0)