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
4 changes: 4 additions & 0 deletions actions/create-pr/dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23139,6 +23139,7 @@ var require_dist = __commonJS({
generateRandomSuffix: () => generateRandomSuffix2,
getInput: () => getInput22,
getNumberInput: () => getNumberInput,
getOptInput: () => getOptInput,
gitAdd: () => gitAdd2,
gitCheckoutBranch: () => gitCheckoutBranch2,
gitCommit: () => gitCommit2,
Expand Down Expand Up @@ -23180,6 +23181,9 @@ var require_dist = __commonJS({
function getInput22(name) {
return core4.getInput(name, { required: true, trimWhitespace: true });
}
function getOptInput(name, defaultValue) {
return core4.getInput(name, { required: false, trimWhitespace: true }) || defaultValue;
}
function getNumberInput(name) {
const input = getInput22(name);
const numberInput = Number(input);
Expand Down
56 changes: 56 additions & 0 deletions actions/submit-docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Submit Documentation Action

This action triggers the `pull-projects-docs` workflow on a destination repository to sync the documentation files. An example of this workflow is available [here](https://github.com/dfinity/icp-js-sdk-docs/blob/ad33d389694f4e746473ccd9506aee55740456a7/.github/workflows/pull-project-docs.yml).
Comment thread
nathanosdev marked this conversation as resolved.

## Action inputs

| Input | Description | Default |
| ------------------ | -------------------------------------------------------------------------------- | --------------------------- |
| `destination_repo` | The destination repository to trigger the workflow on | `'dfinity/icp-js-sdk-docs'` |
| `event_type` | The event type to trigger on the destination repository | `'submit-project-docs'` |
| `token` | GitHub token with permissions to trigger workflows on the destination repository | _required_ |

## Example usage

```yaml
name: Submit Docs

on:
push:
branches: [main]

jobs:
submit-docs:
runs-on: ubuntu-latest
steps:
- name: Create GitHub App Token
uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
id: generate_token
with:
app-id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID }}
private-key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }}
owner: dfinity
repo: icp-js-sdk-docs

# Build your docs and put them in the `docs/dist` folder.

- name: Checkout icp-pages branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: icp-pages
path: icp-pages

- name: Assemble docs
uses: dfinity/ci-tools/actions/assemble-docs@luca/assemble-docs-action
with:
docs_output_dir: docs/dist # must be the same the folder where the static docs assets are written after build
docs_version: v1
docs_version_label: 'Version 1'
latest_version_label: 'latest (v1)'
icp_pages_dir: icp-pages # must be the same as the `path` in the checkout step

- name: Submit Documentation
uses: dfinity/ci-tools/actions/submit-docs@main
with:
token: ${{ steps.generate_token.outputs.token }}
```
19 changes: 19 additions & 0 deletions actions/submit-docs/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Submit Documentation
description: Triggers the pull-projects-docs workflow on a destination repository to update project documentation

inputs:
destination_repo:
description: 'The destination repository to trigger the workflow on'
required: false
default: 'dfinity/icp-js-sdk-docs'
event_type:
description: 'The event type to trigger on the destination repository'
required: false
default: 'submit-project-docs'
token:
description: 'GitHub token with permissions to trigger workflows on the destination repository'
required: true

runs:
using: node20
main: dist/index.js
10 changes: 10 additions & 0 deletions actions/submit-docs/build.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as esbuild from 'esbuild';
import path from 'node:path';

await esbuild.build({
entryPoints: [path.resolve(import.meta.dirname, 'src', 'index.ts')],
outfile: path.resolve(import.meta.dirname, 'dist', 'index.js'),
bundle: true,
platform: 'node',
target: 'node20',
});
Loading