Skip to content

add setting to only create, but not update comment #890

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

Merged
merged 3 commits into from
Feb 9, 2023

Conversation

WebFreak001
Copy link
Contributor

note: generated dist/*.js files diff seems to contain a little more, probably due to differing dependencies. It might make sense to check in the package-lock.json file to prevent this from happening when installing the node modules.

Example use-case:

uses: marocchino/sticky-pull-request-comment@v2
with:
  message: |
    Thanks for your Pull Request! This comment will be updated in a few minutes to include possible new deprecations and statistics about the output binary changes.
  only_create: true

Verified

This commit was signed with the committer’s verified signature.
WebFreak001 Jan Jurzitza

Verified

This commit was signed with the committer’s verified signature.
WebFreak001 Jan Jurzitza

Verified

This commit was signed with the committer’s verified signature.
WebFreak001 Jan Jurzitza
@github-actions
Copy link

github-actions bot commented Feb 9, 2023

output of yarn all
yarn run v1.22.19
$ yarn build && yarn format && yarn lint && yarn package && yarn test
$ tsc
$ prettier --write **/*.ts
__tests__/comment.test.ts 332ms
__tests__/config.test.ts 106ms
src/comment.ts 66ms
src/config.ts 32ms
src/main.ts 16ms
$ eslint src/**/*.ts
$ ncc build --source-map --license licenses.txt
ncc: Version 0.36.1
ncc: Compiling file index.js into CJS
  39kB  dist/licenses.txt
  40kB  dist/sourcemap-register.js
 491kB  dist/index.js.map
 667kB  dist/index.js
 491kB  dist/index.js.map
1237kB  [2370ms] - ncc 0.36.1
$ jest
::debug::followSymbolicLinks 'false'
::debug::matchDirectories 'false'
::debug::followSymbolicLinks 'false'
::debug::implicitDescendants 'true'
::debug::matchDirectories 'false'
::debug::omitBrokenSymbolicLinks 'true'
::debug::Search path '/home/runner/work/sticky-pull-request-comment/sticky-pull-request-comment/__tests__/assets/result'
::debug::followSymbolicLinks 'false'
::debug::matchDirectories 'false'
::debug::followSymbolicLinks 'false'
::debug::implicitDescendants 'true'
::debug::matchDirectories 'false'
::debug::omitBrokenSymbolicLinks 'true'
::debug::Search path '/home/runner/work/sticky-pull-request-comment/sticky-pull-request-comment/__tests__/assets'
::debug::followSymbolicLinks 'false'
::debug::matchDirectories 'false'
::debug::followSymbolicLinks 'false'
::debug::implicitDescendants 'true'
::debug::matchDirectories 'false'
::debug::omitBrokenSymbolicLinks 'true'
::debug::Search path '/home/runner/work/sticky-pull-request-comment/sticky-pull-request-comment/__tests__/assets/not_exists'
PASS __tests__/config.test.ts
  ✓ repo (165 ms)
  ✓ header (46 ms)
  ✓ append (43 ms)
  ✓ recreate (51 ms)
  ✓ delete (90 ms)
  ✓ hideOldComment (97 ms)
  ✓ hideAndRecreate (102 ms)
  ✓ hideClassify (61 ms)
  ✓ hideDetails (36 ms)
  ✓ message (37 ms)
  ✓ ignore_empty (35 ms)
  path
    ✓ when exists return content of a file (46 ms)
    ✓ glob match files (53 ms)
    ✓ when not exists return null string (57 ms)

PASS __tests__/comment.test.ts
  ✓ findPreviousComment (10 ms)
  ✓ deleteComment (7 ms)
  ✓ minimizeComment (6 ms)
  updateComment
    ✓ with comment body (2 ms)
    ✓ without comment body and previous body (1 ms)
  createComment
    ✓ with comment body or previousBody (2 ms)
    ✓ without comment body and previousBody (1 ms)
  getBodyOf
    ✓ receive {"body": "
    <details>
    <summary>title</summary>

    content
    </details>
    <!-- Sticky Pull Request CommentTypeA -->
  "}, false, false and returns undefined (1 ms)
    ✓ receive {}, true, false and returns undefined
    ✓ receive {"body": "
    <details>
    <summary>title</summary>

    content
    </details>
    <!-- Sticky Pull Request CommentTypeA -->
  "}, true, false and returns 
    <details>
    <summary>title</summary>

    content
    </details>
    <!-- Sticky Pull Request CommentTypeA -->
   (1 ms)
    ✓ receive {}, true, true and returns undefined
    ✓ receive {"body": "hello there
<!-- Sticky Pull Request CommentTypeA -->"}, true, true and returns hello there
<!-- Sticky Pull Request CommentTypeA --> (1 ms)
    ✓ receive {"body": "
    <details>
    <summary>title</summary>

    content
    </details>
    <!-- Sticky Pull Request CommentTypeA -->
  "}, true, true and returns 
    <details>
    <summary>title</summary>

    content
    </details>
    <!-- Sticky Pull Request CommentTypeA -->
   (1 ms)

Test Suites: 2 passed, 2 total
Tests:       27 passed, 27 total
Snapshots:   0 total
Time:        5.627 s
Ran all test suites.
Done in 29.23s.

The build is over.

@WebFreak001
Copy link
Contributor Author

WebFreak001 commented Feb 9, 2023

index.js has still changed a lot because of dependency updates / not using a lock file.

There is the yarn.lock file, but I'm not sure what it's doing, it's just getting updated locally with a bunch of quotes around all kinds of values and I chose not to check it in.

@marocchino
Copy link
Owner

I will add index.js in .gitignore later. Thank you for your concern!

@marocchino marocchino merged commit 4608256 into marocchino:main Feb 9, 2023
@marocchino
Copy link
Owner

It tagged as v2.4.0, v2. Thank you.

@WebFreak001 WebFreak001 deleted the only_create-setting branch February 9, 2023 18:21
@WebFreak001
Copy link
Contributor Author

for index.js it's important it's kept updated because that's what's actually going to be run on the github action. If you decide to omit the dist folder, you need to have a separate branch or individual separate commits that have the dist folder contained with CI generated index.js

I think package-lock.json should just be checked in, so when running npm install, the correct versions are installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants