diff --git a/.github/workflows/comment_on_workflow_run.yml b/.github/workflows/comment_on_workflow_run.yml deleted file mode 100644 index 7c4eb40..0000000 --- a/.github/workflows/comment_on_workflow_run.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Comment on Workflow Run - -on: - workflow_run: - workflows: - - "Test" - types: - - completed - -jobs: - comment: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.event == 'pull_request' }} - steps: - - uses: actions/checkout@v3 - - name: on artifact - id: artifact - uses: marocchino/on_artifact@v1 - with: - name: all - - uses: ./ - with: - header: All - number: ${{ steps.artifact.outputs.number }} - message: | -
- output of yarn all - - ``` - ${{ steps.artifact.outputs.all_result }} - ``` -
- - uses: ./ - with: - header: All - number: ${{ steps.artifact.outputs.number }} - append: true - hide_details: true - message: | - The build is over. diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 69642c7..60f5177 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,6 @@ name: Test on: - pull_request: + pull_request_target: push: branches: - main @@ -8,6 +8,8 @@ on: jobs: test: runs-on: ubuntu-latest + permissions: + pull-requests: write steps: - uses: actions/checkout@v3 - run: yarn install @@ -15,9 +17,28 @@ jobs: set -o pipefail mkdir -p ./pr echo ${{ github.event.number }} | tee ./pr/number - yarn all |& tee ./pr/all_result - - uses: actions/upload-artifact@v3 - if: ${{ github.event_name == 'pull_request' && (success() || failure()) }} + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) + echo "all_result<<$EOF" >> "$GITHUB_ENV" + yarn all >> "$GITHUB_ENV" + echo "$EOF" >> "$GITHUB_ENV" + id: all + - uses: ./ + if: ${{ github.event_name == 'pull_request_target' }} with: - name: all - path: pr/ + header: All + message: | +
+ output of yarn all + + ``` + ${{ env.all_result }} + ``` +
+ - uses: ./ + if: ${{ github.event_name == 'pull_request_target' }} + with: + header: All + append: true + hide_details: true + message: | + The build is over. diff --git a/README.md b/README.md index f91624b..acb54f5 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,13 @@ This library runs with GitHub Actions. If you feel that the example grammar belo ### Basic +You need to add permissions for this tool. + +```yaml +permissions: + pull-requests: write +``` + ```yaml uses: marocchino/sticky-pull-request-comment@v2 with: @@ -30,19 +37,17 @@ release: test: ... - name: Run Test - id: test run: | - OUTPUT=$(rake test) - OUTPUT="${OUTPUT//'%'/'%25'}​【7,6 m】" - OUTPUT="${OUTPUT//$'\n'/'%0A'}" - OUTPUT="${OUTPUT//$'\r'/'%0D'}" - echo "result=$OUTPUT" >> $GITHUB_OUTPUT + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) + echo "test_result<<$EOF" >> "$GITHUB_ENV" + rake test >> "$GITHUB_ENV" + echo "$EOF" >> "$GITHUB_ENV" - uses: marocchino/sticky-pull-request-comment@v2 with: header: test message: | ``` - ${{ steps.test.outputs.result }} + ${{ env.test_result }} ``` ```` @@ -52,20 +57,18 @@ test: test: ... - name: Run Test - id: test run: | - OUTPUT=$(rake test) - OUTPUT="${OUTPUT//'%'/'%25'}​【7,6 m】" - OUTPUT="${OUTPUT//$'\n'/'%0A'}" - OUTPUT="${OUTPUT//$'\r'/'%0D'}" - echo "result=$OUTPUT" >> $GITHUB_OUTPUT + EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) + echo "test_result<<$EOF" >> "$GITHUB_ENV" + rake test >> "$GITHUB_ENV" + echo "$EOF" >> "$GITHUB_ENV" - uses: marocchino/sticky-pull-request-comment@v2 with: append: true message: | Test with ${{ github.sha }}. ``` - ${{ steps.test.outputs.result }} + ${{ env.test_result }} ``` ```` @@ -134,8 +137,18 @@ with: ### Error: Resource not accessible by integration -This message means the requester does not have enough permission. If `secrets.GITHUB_TOKEN` -is explicitly passed, this problem can be solved by just removing it. +This tool requires write permission, and that message means the requester does not have enough permission. +Recently, GitHub sets permissions conservatively for newly created repositories. If it's a newly created repository, check your Settings > Actions > General > Workflow permissions, and make sure to enable read and write permissions. + +Then, you can specify permissions for the job like this: + +```yaml +permissions: + pull-requests: write +``` + +For more detailed information about permissions, you can read from the link below: + ## Inputs diff --git a/package.json b/package.json index 65ca5a9..f1b27f6 100644 --- a/package.json +++ b/package.json @@ -33,16 +33,16 @@ }, "devDependencies": { "@types/jest": "^27.4.1", - "@types/node": "^18.15.11", - "@typescript-eslint/parser": "^5.59.0", + "@types/node": "^18.16.2", + "@typescript-eslint/parser": "^5.59.1", "@vercel/ncc": "^0.36.1", - "eslint": "^8.38.0", + "eslint": "^8.39.0", "eslint-plugin-github": "^4.7.0", "eslint-plugin-jest": "^27.2.1", "jest": "^27.5.1", "jest-circus": "^29.5.0", "js-yaml": "^4.1.0", - "prettier": "2.8.7", + "prettier": "2.8.8", "ts-jest": "^27.1.4", "typescript": "^4.9.5" } diff --git a/yarn.lock b/yarn.lock index 6bb070c..57d8ea7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -751,10 +751,10 @@ minimatch "^3.1.2" strip-json-comments "^3.1.1" -"@eslint/js@8.38.0": - version "8.38.0" - resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.38.0.tgz#73a8a0d8aa8a8e6fe270431c5e72ae91b5337892" - integrity sha512-IoD2MfUnOV58ghIHCiil01PcohxjbYR/qCxsoC+xNgUwh1EY8jOOrYmu3d3a71+tJJ23uscEV4X2HJWMsPJu4g== +"@eslint/js@8.39.0": + version "8.39.0" + resolved "https://registry.yarnpkg.com/@eslint/js/-/js-8.39.0.tgz#58b536bcc843f4cd1e02a7e6171da5c040f4d44b" + integrity sha512-kf9RB0Fg7NZfap83B3QOqOGg9QmD9yBudqQXzzOtn3i4y7ZUXe5ONeW34Gwi+TxhH4mvj72R1Zc300KUMa9Bng== "@github/browserslist-config@^1.0.0": version "1.0.0" @@ -1377,10 +1377,10 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha1-7ihweulOEdK4J7y+UnC86n8+ce4= -"@types/node@*", "@types/node@^18.15.11": - version "18.15.11" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.11.tgz#b3b790f09cb1696cffcec605de025b088fa4225f" - integrity sha512-E5Kwq2n4SbMzQOn6wnmBjuK9ouqlURrcZDVfbo9ftDDTFt3nk7ZKK4GMOzoYgnpQJKcxwQw+lGaBvvlMo0qN/Q== +"@types/node@*", "@types/node@^18.16.2": + version "18.16.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.16.2.tgz#2f610ea71034b3971c312192377f8a7178eb57f1" + integrity sha512-GQW/JL/5Fz/0I8RpeBG9lKp0+aNcXEaVL71c0D2Q0QHDTFvlYKT7an0onCUXj85anv7b4/WesqdfchLc0jtsCg== "@types/prettier@^2.1.5": version "2.3.2" @@ -1437,14 +1437,14 @@ eslint-scope "^5.1.1" eslint-utils "^3.0.0" -"@typescript-eslint/parser@^5.1.0", "@typescript-eslint/parser@^5.59.0": - version "5.59.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.59.0.tgz#0ad7cd019346cc5d150363f64869eca10ca9977c" - integrity sha512-qK9TZ70eJtjojSUMrrEwA9ZDQ4N0e/AuoOIgXuNBorXYcBDk397D2r5MIe1B3cok/oCtdNC5j+lUUpVB+Dpb+w== +"@typescript-eslint/parser@^5.1.0", "@typescript-eslint/parser@^5.59.1": + version "5.59.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-5.59.1.tgz#73c2c12127c5c1182d2e5b71a8fa2a85d215cbb4" + integrity sha512-nzjFAN8WEu6yPRDizIFyzAfgK7nybPodMNFGNH0M9tei2gYnYszRDqVA0xlnRjkl7Hkx2vYrEdb6fP2a21cG1g== dependencies: - "@typescript-eslint/scope-manager" "5.59.0" - "@typescript-eslint/types" "5.59.0" - "@typescript-eslint/typescript-estree" "5.59.0" + "@typescript-eslint/scope-manager" "5.59.1" + "@typescript-eslint/types" "5.59.1" + "@typescript-eslint/typescript-estree" "5.59.1" debug "^4.3.4" "@typescript-eslint/scope-manager@5.10.1": @@ -1463,13 +1463,13 @@ "@typescript-eslint/types" "5.3.1" "@typescript-eslint/visitor-keys" "5.3.1" -"@typescript-eslint/scope-manager@5.59.0": - version "5.59.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.0.tgz#86501d7a17885710b6716a23be2e93fc54a4fe8c" - integrity sha512-tsoldKaMh7izN6BvkK6zRMINj4Z2d6gGhO2UsI8zGZY3XhLq1DndP3Ycjhi1JwdwPRwtLMW4EFPgpuKhbCGOvQ== +"@typescript-eslint/scope-manager@5.59.1": + version "5.59.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/scope-manager/-/scope-manager-5.59.1.tgz#8a20222719cebc5198618a5d44113705b51fd7fe" + integrity sha512-mau0waO5frJctPuAzcxiNWqJR5Z8V0190FTSqRw1Q4Euop6+zTwHAf8YIXNwDOT29tyUDrQ65jSg9aTU/H0omA== dependencies: - "@typescript-eslint/types" "5.59.0" - "@typescript-eslint/visitor-keys" "5.59.0" + "@typescript-eslint/types" "5.59.1" + "@typescript-eslint/visitor-keys" "5.59.1" "@typescript-eslint/types@5.10.1": version "5.10.1" @@ -1481,10 +1481,10 @@ resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.3.1.tgz#afaa715b69ebfcfde3af8b0403bf27527912f9b7" integrity sha512-bG7HeBLolxKHtdHG54Uac750eXuQQPpdJfCYuw4ZI3bZ7+GgKClMWM8jExBtp7NSP4m8PmLRM8+lhzkYnSmSxQ== -"@typescript-eslint/types@5.59.0": - version "5.59.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.0.tgz#3fcdac7dbf923ec5251545acdd9f1d42d7c4fe32" - integrity sha512-yR2h1NotF23xFFYKHZs17QJnB51J/s+ud4PYU4MqdZbzeNxpgUr05+dNeCN/bb6raslHvGdd6BFCkVhpPk/ZeA== +"@typescript-eslint/types@5.59.1": + version "5.59.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/types/-/types-5.59.1.tgz#03f3fedd1c044cb336ebc34cc7855f121991f41d" + integrity sha512-dg0ICB+RZwHlysIy/Dh1SP+gnXNzwd/KS0JprD3Lmgmdq+dJAJnUPe1gNG34p0U19HvRlGX733d/KqscrGC1Pg== "@typescript-eslint/typescript-estree@5.10.1": version "5.10.1" @@ -1512,13 +1512,13 @@ semver "^7.3.5" tsutils "^3.21.0" -"@typescript-eslint/typescript-estree@5.59.0": - version "5.59.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.0.tgz#8869156ee1dcfc5a95be3ed0e2809969ea28e965" - integrity sha512-sUNnktjmI8DyGzPdZ8dRwW741zopGxltGs/SAPgGL/AAgDpiLsCFLcMNSpbfXfmnNeHmK9h3wGmCkGRGAoUZAg== +"@typescript-eslint/typescript-estree@5.59.1": + version "5.59.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-5.59.1.tgz#4aa546d27fd0d477c618f0ca00b483f0ec84c43c" + integrity sha512-lYLBBOCsFltFy7XVqzX0Ju+Lh3WPIAWxYpmH/Q7ZoqzbscLiCW00LeYCdsUnnfnj29/s1WovXKh2gwCoinHNGA== dependencies: - "@typescript-eslint/types" "5.59.0" - "@typescript-eslint/visitor-keys" "5.59.0" + "@typescript-eslint/types" "5.59.1" + "@typescript-eslint/visitor-keys" "5.59.1" debug "^4.3.4" globby "^11.1.0" is-glob "^4.0.3" @@ -1553,12 +1553,12 @@ "@typescript-eslint/types" "5.3.1" eslint-visitor-keys "^3.0.0" -"@typescript-eslint/visitor-keys@5.59.0": - version "5.59.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.0.tgz#a59913f2bf0baeb61b5cfcb6135d3926c3854365" - integrity sha512-qZ3iXxQhanchCeaExlKPV3gDQFxMUmU35xfd5eCXB6+kUw1TUAbIy2n7QIrwz9s98DQLzNWyHp61fY0da4ZcbA== +"@typescript-eslint/visitor-keys@5.59.1": + version "5.59.1" + resolved "https://registry.yarnpkg.com/@typescript-eslint/visitor-keys/-/visitor-keys-5.59.1.tgz#0d96c36efb6560d7fb8eb85de10442c10d8f6058" + integrity sha512-6waEYwBTCWryx0VJmP7JaM4FpipLsFl9CvYf2foAE8Qh/Y0s+bxWysciwOs0LTBED4JCaNxTZ5rGadB14M6dwA== dependencies: - "@typescript-eslint/types" "5.59.0" + "@typescript-eslint/types" "5.59.1" eslint-visitor-keys "^3.3.0" "@vercel/ncc@^0.36.1": @@ -2590,10 +2590,10 @@ eslint-scope@^5.1.1: esrecurse "^4.3.0" estraverse "^4.1.1" -eslint-scope@^7.1.1: - version "7.1.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.1.1.tgz#fff34894c2f65e5226d3041ac480b4513a163642" - integrity sha512-QKQM/UXpIiHcLqJ5AOyIW7XZmzjkzQXYE54n1++wb0u9V/abW3l9uQnxX8Z5Xd18xyKIMTUAyQ0k1e8pz6LUrw== +eslint-scope@^7.2.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-7.2.0.tgz#f21ebdafda02352f103634b96dd47d9f81ca117b" + integrity sha512-DYj5deGlHBfMt15J7rdtyKNq/Nqlv5KfU4iodrQ019XESsRnwXH9KAE0y3cwtUHDo2ob7CypAnCqefh6vioWRw== dependencies: esrecurse "^4.3.0" estraverse "^5.2.0" @@ -2615,15 +2615,15 @@ eslint-visitor-keys@^3.0.0, eslint-visitor-keys@^3.3.0, eslint-visitor-keys@^3.4 resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-3.4.0.tgz#c7f0f956124ce677047ddbc192a68f999454dedc" integrity sha512-HPpKPUBQcAsZOsHAFwTtIKcYlCje62XB7SEAcxjtmW6TD1WVpkS6i6/hOVtTZIl4zGj/mBqpFVGvaDneik+VoQ== -eslint@^8.38.0: - version "8.38.0" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.38.0.tgz#a62c6f36e548a5574dd35728ac3c6209bd1e2f1a" - integrity sha512-pIdsD2jwlUGf/U38Jv97t8lq6HpaU/G9NKbYmpWpZGw3LdTNhZLbJePqxOXGB5+JEKfOPU/XLxYxFh03nr1KTg== +eslint@^8.39.0: + version "8.39.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-8.39.0.tgz#7fd20a295ef92d43809e914b70c39fd5a23cf3f1" + integrity sha512-mwiok6cy7KTW7rBpo05k6+p4YVZByLNjAZ/ACB9DRCu4YDRwjXI01tWHp6KAUWelsBetTxKK/2sHB0vdS8Z2Og== dependencies: "@eslint-community/eslint-utils" "^4.2.0" "@eslint-community/regexpp" "^4.4.0" "@eslint/eslintrc" "^2.0.2" - "@eslint/js" "8.38.0" + "@eslint/js" "8.39.0" "@humanwhocodes/config-array" "^0.11.8" "@humanwhocodes/module-importer" "^1.0.1" "@nodelib/fs.walk" "^1.2.8" @@ -2633,7 +2633,7 @@ eslint@^8.38.0: debug "^4.3.2" doctrine "^3.0.0" escape-string-regexp "^4.0.0" - eslint-scope "^7.1.1" + eslint-scope "^7.2.0" eslint-visitor-keys "^3.4.0" espree "^9.5.1" esquery "^1.4.2" @@ -4679,10 +4679,10 @@ prettier-linter-helpers@^1.0.0: dependencies: fast-diff "^1.1.2" -prettier@2.8.7, prettier@^2.2.1: - version "2.8.7" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.7.tgz#bb79fc8729308549d28fe3a98fce73d2c0656450" - integrity sha512-yPngTo3aXUUmyuTjeTUT75txrf+aMh9FiD7q9ZE/i6r0bPb22g4FsE6Y338PQX1bmfy08i9QQCB7/rcUAVntfw== +prettier@2.8.8, prettier@^2.2.1: + version "2.8.8" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.8.tgz#e8c5d7e98a4305ffe3de2e1fc4aca1a71c28b1da" + integrity sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q== pretty-format@^27.0.0, pretty-format@^27.5.1: version "27.5.1"