Refactor pipeline parsing and forge refreshing (#2527)

- refactor pipeline parsing
- do not parse the pipeline multiple times to perform filter checks, do
this once and perform checks on the result directly
    - code deduplication
- refactor forge token refreshing
    - move refreshing to a helper func to reduce code

---------

Co-authored-by: Anbraten <anton@ju60.de>
This commit is contained in:
qwerty287
2023-10-08 14:05:06 +02:00
committed by GitHub
parent 2f4690a6b6
commit 22dfd2ef62
23 changed files with 251 additions and 392 deletions

View File

@@ -29,12 +29,5 @@ export default () => {
}
const { pipeline } = data;
pipelineStore.setPipeline(repo.id, pipeline);
// contains step update
if (!data.step) {
return;
}
const { step } = data;
pipelineStore.setWorkflow(repo.id, pipeline.number, step);
});
};

View File

@@ -8,7 +8,6 @@ import {
PipelineConfig,
PipelineFeed,
PipelineLog,
PipelineWorkflow,
PullRequest,
QueueInfo,
Registry,
@@ -316,7 +315,7 @@ export default class WoodpeckerClient extends ApiClient {
}
// eslint-disable-next-line promise/prefer-await-to-callbacks
on(callback: (data: { pipeline?: Pipeline; repo?: Repo; step?: PipelineWorkflow }) => void): EventSource {
on(callback: (data: { pipeline?: Pipeline; repo?: Repo }) => void): EventSource {
return this._subscribe('/api/stream/events', callback, {
reconnect: true,
});