mirror of
https://github.com/marocchino/sticky-pull-request-comment.git
synced 2025-12-16 21:18:27 +00:00
commit
13efbe43d6
3 changed files with 51 additions and 61 deletions
40
.github/workflows/comment_on_workflow_run.yml
vendored
40
.github/workflows/comment_on_workflow_run.yml
vendored
|
|
@ -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: |
|
|
||||||
<details open>
|
|
||||||
<summary>output of yarn all</summary>
|
|
||||||
|
|
||||||
```
|
|
||||||
${{ steps.artifact.outputs.all_result }}
|
|
||||||
```
|
|
||||||
</details>
|
|
||||||
- uses: ./
|
|
||||||
with:
|
|
||||||
header: All
|
|
||||||
number: ${{ steps.artifact.outputs.number }}
|
|
||||||
append: true
|
|
||||||
hide_details: true
|
|
||||||
message: |
|
|
||||||
The build is over.
|
|
||||||
27
.github/workflows/test.yml
vendored
27
.github/workflows/test.yml
vendored
|
|
@ -15,9 +15,26 @@ jobs:
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
mkdir -p ./pr
|
mkdir -p ./pr
|
||||||
echo ${{ github.event.number }} | tee ./pr/number
|
echo ${{ github.event.number }} | tee ./pr/number
|
||||||
yarn all |& tee ./pr/all_result
|
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
|
||||||
- uses: actions/upload-artifact@v3
|
echo "all_result<<$EOF" >> "$GITHUB_ENV"
|
||||||
if: ${{ github.event_name == 'pull_request' && (success() || failure()) }}
|
yarn all >> "$GITHUB_ENV"
|
||||||
|
echo "$EOF" >> "$GITHUB_ENV"
|
||||||
|
id: all
|
||||||
|
- uses: ./
|
||||||
with:
|
with:
|
||||||
name: all
|
header: All
|
||||||
path: pr/
|
message: |
|
||||||
|
<details open>
|
||||||
|
<summary>output of yarn all</summary>
|
||||||
|
|
||||||
|
```
|
||||||
|
${{ env.all_result }}
|
||||||
|
```
|
||||||
|
</details>
|
||||||
|
- uses: ./
|
||||||
|
with:
|
||||||
|
header: All
|
||||||
|
append: true
|
||||||
|
hide_details: true
|
||||||
|
message: |
|
||||||
|
The build is over.
|
||||||
|
|
|
||||||
45
README.md
45
README.md
|
|
@ -7,6 +7,13 @@ This library runs with GitHub Actions. If you feel that the example grammar belo
|
||||||
|
|
||||||
### Basic
|
### Basic
|
||||||
|
|
||||||
|
You need to add permissions for this tool.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
```
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
uses: marocchino/sticky-pull-request-comment@v2
|
uses: marocchino/sticky-pull-request-comment@v2
|
||||||
with:
|
with:
|
||||||
|
|
@ -30,19 +37,17 @@ release:
|
||||||
test:
|
test:
|
||||||
...
|
...
|
||||||
- name: Run Test
|
- name: Run Test
|
||||||
id: test
|
|
||||||
run: |
|
run: |
|
||||||
OUTPUT=$(rake test)
|
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
|
||||||
OUTPUT="${OUTPUT//'%'/'%25'}【7,6 m】"
|
echo "test_result<<$EOF" >> "$GITHUB_ENV"
|
||||||
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
|
rake test >> "$GITHUB_ENV"
|
||||||
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
|
echo "$EOF" >> "$GITHUB_ENV"
|
||||||
echo "result=$OUTPUT" >> $GITHUB_OUTPUT
|
|
||||||
- uses: marocchino/sticky-pull-request-comment@v2
|
- uses: marocchino/sticky-pull-request-comment@v2
|
||||||
with:
|
with:
|
||||||
header: test
|
header: test
|
||||||
message: |
|
message: |
|
||||||
```
|
```
|
||||||
${{ steps.test.outputs.result }}
|
${{ env.test_result }}
|
||||||
```
|
```
|
||||||
````
|
````
|
||||||
|
|
||||||
|
|
@ -52,20 +57,18 @@ test:
|
||||||
test:
|
test:
|
||||||
...
|
...
|
||||||
- name: Run Test
|
- name: Run Test
|
||||||
id: test
|
|
||||||
run: |
|
run: |
|
||||||
OUTPUT=$(rake test)
|
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
|
||||||
OUTPUT="${OUTPUT//'%'/'%25'}【7,6 m】"
|
echo "test_result<<$EOF" >> "$GITHUB_ENV"
|
||||||
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
|
rake test >> "$GITHUB_ENV"
|
||||||
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
|
echo "$EOF" >> "$GITHUB_ENV"
|
||||||
echo "result=$OUTPUT" >> $GITHUB_OUTPUT
|
|
||||||
- uses: marocchino/sticky-pull-request-comment@v2
|
- uses: marocchino/sticky-pull-request-comment@v2
|
||||||
with:
|
with:
|
||||||
append: true
|
append: true
|
||||||
message: |
|
message: |
|
||||||
Test with ${{ github.sha }}.
|
Test with ${{ github.sha }}.
|
||||||
```
|
```
|
||||||
${{ steps.test.outputs.result }}
|
${{ env.test_result }}
|
||||||
```
|
```
|
||||||
````
|
````
|
||||||
|
|
||||||
|
|
@ -134,8 +137,18 @@ with:
|
||||||
|
|
||||||
### Error: Resource not accessible by integration
|
### Error: Resource not accessible by integration
|
||||||
|
|
||||||
This message means the requester does not have enough permission. If `secrets.GITHUB_TOKEN`
|
This tool requires write permission, and that message means the requester does not have enough permission.
|
||||||
is explicitly passed, this problem can be solved by just removing it.
|
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:
|
||||||
|
<https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs>
|
||||||
|
|
||||||
## Inputs
|
## Inputs
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue