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

Fix jsdoc automation build issue & parametrize PR branch target #1547

Merged
merged 3 commits into from
Dec 28, 2024
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
14 changes: 10 additions & 4 deletions .github/workflows/jsdoc-automation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ on:
required: true
default: ''
type: string
branch:
description: 'Target branch for PR (defaults to develop)'
required: false
default: 'develop'
type: string

jobs:
generate-docs:
Expand Down Expand Up @@ -49,7 +54,7 @@ jobs:
run_install: false

- name: Update lockfile
working-directory: packages/jsdoc-automation
working-directory: scripts/jsdoc-automation
run: |
echo "Updating lockfile..."
pnpm install --no-frozen-lockfile
Expand All @@ -63,11 +68,11 @@ jobs:
run: pnpm install --no-frozen-lockfile

- name: Install package dependencies
working-directory: packages/jsdoc-automation
working-directory: scripts/jsdoc-automation
run: pnpm install --no-frozen-lockfile

- name: Run documentation generator
working-directory: packages/jsdoc-automation
working-directory: scripts/jsdoc-automation
run: |
echo "Node version: $(node --version)"
echo "NPM version: $(npm --version)"
Expand All @@ -78,4 +83,5 @@ jobs:
INPUT_ROOT_DIRECTORY: ${{ inputs.root_directory }}
INPUT_PULL_NUMBER: ${{ inputs.pull_number }}
INPUT_EXCLUDED_DIRECTORIES: ${{ inputs.excluded_directories }}
INPUT_REVIEWERS: ${{ inputs.reviewers }}
INPUT_REVIEWERS: ${{ inputs.reviewers }}
INPUT_BRANCH: ${{ inputs.branch }}
13 changes: 12 additions & 1 deletion scripts/jsdoc-automation/src/Configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ interface ConfigurationData {
export class Configuration implements Omit<ConfigurationData, 'rootDirectory'> {
private _rootDirectory!: ConfigurationData['rootDirectory'];
private readonly repoRoot: string;
private _branch: string = 'develop';

public excludedDirectories: string[] = [];
public repository: Repository = {
Expand All @@ -49,7 +50,6 @@ export class Configuration implements Omit<ConfigurationData, 'rootDirectory'> {
public pullRequestLabels: string[] = ['documentation', 'automated-pr'];
public pullRequestReviewers: string[] = [];
public excludedFiles: string[] = ["index.d.ts"];
public branch: string = 'develop';

constructor() {
this.repoRoot = getRepoRoot();
Expand All @@ -76,6 +76,14 @@ export class Configuration implements Omit<ConfigurationData, 'rootDirectory'> {
return path.resolve(this.repoRoot, relativePath);
}

get branch(): string {
return this._branch;
}

set branch(value: string) {
this._branch = value;
}

private loadConfiguration(): void {
// First try to get from environment variables
const rootDirectory = process.env.INPUT_ROOT_DIRECTORY;
Expand Down Expand Up @@ -136,6 +144,9 @@ export class Configuration implements Omit<ConfigurationData, 'rootDirectory'> {
process.env.INPUT_REVIEWERS,
[]
);

this._branch = process.env.INPUT_BRANCH || 'develop';
console.log('Using branch:', this._branch);
}

private parseCommaSeparatedInput(input: string | undefined, defaultValue: string[]): string[] {
Expand Down
Loading