Skip to content

Commit

Permalink
fix: avoid empty lines in data/endorsements.csv
Browse files Browse the repository at this point in the history
  • Loading branch information
gr2m committed Aug 1, 2023
1 parent dff4e0f commit fcde23b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ export default async function run(app, logger = pino()) {

const hasChanges =
// `headers.etag` usually looks like this: W/"8f39bae6a3b630823ddee0476c82463015e93232"
// @ts-expect-error - `etag` is always set for this endpoint
etag.replace(/(^(\w\/)?"|"$)/g, "") !== sourceFile.lastFileSha;

if (!hasChanges) {
Expand All @@ -209,6 +208,10 @@ export default async function run(app, logger = pino()) {

const { endorsements, lastCommitSha, lastUpdatedAt, lastFileSha } = result;

if (endorsements.length === 0) {
continue;
}

const updateFileShaRegex = new RegExp(`${uniqueLineMatchString}[^\\n]+`);

// update source files file with new last commit sha
Expand Down
1 change: 0 additions & 1 deletion lib/find-repository-file-endorsements.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,6 @@ export async function findRepositoryFileEndorsements(
);

// `headers.etag` usually looks like this: W/"8f39bae6a3b630823ddee0476c82463015e93232"
// @ts-expect-error - `etag` is always set for this endpoint
const lastFileSha = headers.etag.replace(/(^(\w\/)?"|"$)/g, "");

return {
Expand Down

0 comments on commit fcde23b

Please sign in to comment.