Skip to content

Commit

Permalink
Merge pull request #1547 from Ed-Marcavage/fix/jsdoc-automation
Browse files Browse the repository at this point in the history
Fix jsdoc automation build issue & parametrize PR branch target
  • Loading branch information
madjin authored Dec 28, 2024
2 parents 555479a + 8a1b698 commit 74e4ef2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
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

0 comments on commit 74e4ef2

Please sign in to comment.