-
Notifications
You must be signed in to change notification settings - Fork 1
feat: submit-docs action #47
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
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3e21d03
feat: submit-docs action
ilbertt 7b3d449
fix: do not require optional inputs
ilbertt 3d3f9f1
fix: remove quotes
ilbertt 0567c17
fix: run action
ilbertt d11f79d
ci: adapt submit docs action to latest changes
ilbertt ebba805
chore: update readme
ilbertt 0436d09
fix: build action
ilbertt 7a2f4ed
chore: update readme
ilbertt 17f674a
refactor: getOptInput
ilbertt 23ddfef
fix: add type inference
ilbertt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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). | ||
|
|
||
| ## 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 }} | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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', | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.