Skip to content

Commit

Permalink
fix: Improve filtering of ignored-dependecies
Browse files Browse the repository at this point in the history
There was an issue related to ignoring dependencies causing that none of
the libs were processed when ingoredDependecies was empty. Filtering
adjusted in order to satify that it won't match every asset name when
empty.
Every string startsWith empty string, therefore we were excluding all
assets when ingore dependencies empty
  • Loading branch information
Baraujo25 committed Nov 22, 2024
1 parent bc65737 commit dae0448
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 17 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
plugin-id: bzm-siebel
changes: some changes
token: ${{ secrets.GH_TOKEN }}
ignore-dependencies: bzm-repositories
env:
TEST_GITHUB_REPOSITORY: 'Blazemeter/CorrelationRecorder'

Expand Down
13 changes: 6 additions & 7 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { info, setFailed, setOutput } from '@actions/core'
import { setFailed, setOutput } from '@actions/core'
import { Arguments } from './args.js'
import { GitService } from './git.js'
import { GithubService } from './github.js'
Expand All @@ -21,6 +21,7 @@ export async function run(): Promise<void> {
const releaseBuilder: ReleaseBuilder = new ReleaseBuilder(args, githubService.getAssets())
const release: PluginVersion = await releaseBuilder.build()
const version: string = githubService.getReleaseVersion()

await applyRelease(
await releaseBuilder.findFilePluginRepository(),
release,
Expand Down Expand Up @@ -51,7 +52,6 @@ export async function run(): Promise<void> {
if (plugin) {
plugin.versions[releaseVersion] = release
writeFileSync(releaseFile, JSON.stringify(plugins, null, 2), 'utf-8')
info(`Release Object: ${JSON.stringify(release)}`)
return
}
throw Error(`The plugin id:"${pluginID}" was not found in ${releaseFile}`)
Expand Down
15 changes: 8 additions & 7 deletions src/release-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,16 @@ export class ReleaseBuilder {

private buildLibs(): Record<string, string> {
const libs: Record<string, string> = {}
this.assets.forEach(asset => {
if (
!asset.name.startsWith(this.args.pluginArtifactName) &&
!this.args.ingoreDependencies.some(ignore => asset.name.startsWith(ignore))
) {
this.assets
.filter(asset => !asset.name.startsWith(this.args.pluginArtifactName))
.filter(
asset =>
!this.args.ingoreDependencies.some(ignore => ignore && asset.name.startsWith(ignore))
)
.forEach(asset => {
const { libKey, url } = this.buildLibKeyAndUrl(asset)
libs[libKey] = url
}
})
})
return libs
}

Expand Down

0 comments on commit dae0448

Please sign in to comment.