2020-05-01 19:10:35 +09:00
|
|
|
name: CI
|
|
|
|
on:
|
|
|
|
push:
|
2021-05-12 17:18:15 +09:00
|
|
|
branches: [main]
|
2020-05-06 11:45:41 +09:00
|
|
|
paths-ignore:
|
|
|
|
- 'README.md'
|
|
|
|
- 'docs/**'
|
2020-05-01 19:10:35 +09:00
|
|
|
pull_request:
|
2021-05-12 17:18:15 +09:00
|
|
|
branches: [main]
|
2020-05-06 11:45:41 +09:00
|
|
|
paths-ignore:
|
|
|
|
- 'README.md'
|
|
|
|
- 'docs/**'
|
2022-08-19 11:21:32 +09:00
|
|
|
|
|
|
|
permissions:
|
|
|
|
issues: write
|
|
|
|
pull-requests: write
|
|
|
|
contents: write
|
|
|
|
|
2020-05-01 19:10:35 +09:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
issue-number: ${{ steps.vars.outputs.issue-number }}
|
|
|
|
steps:
|
2023-09-06 05:47:37 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-10-25 05:19:35 +00:00
|
|
|
- uses: actions/setup-node@v4
|
2020-05-01 19:10:35 +09:00
|
|
|
with:
|
2024-01-25 20:45:09 +09:00
|
|
|
node-version: 20.x
|
2022-12-09 17:07:54 +09:00
|
|
|
cache: npm
|
2020-05-01 19:10:35 +09:00
|
|
|
- run: npm ci
|
2023-04-05 16:14:13 +09:00
|
|
|
- run: npm run build
|
|
|
|
- run: npm run format-check
|
|
|
|
- run: npm run lint
|
2020-05-01 19:10:35 +09:00
|
|
|
- run: npm run test
|
2023-12-20 09:00:53 +00:00
|
|
|
- uses: actions/upload-artifact@v4
|
2020-05-01 19:10:35 +09:00
|
|
|
with:
|
|
|
|
name: dist
|
|
|
|
path: dist
|
2023-12-20 09:00:53 +00:00
|
|
|
- uses: actions/upload-artifact@v4
|
2020-06-02 18:33:54 +09:00
|
|
|
with:
|
|
|
|
name: action.yml
|
|
|
|
path: action.yml
|
2020-05-01 19:10:35 +09:00
|
|
|
- id: vars
|
|
|
|
run: |
|
|
|
|
if [[ "${{ github.event_name }}" == "pull_request" ]]; then \
|
2022-10-18 16:56:13 +09:00
|
|
|
echo "issue-number=${{ github.event.number }}" >> $GITHUB_OUTPUT; \
|
2020-05-01 19:10:35 +09:00
|
|
|
else \
|
2022-10-18 16:56:13 +09:00
|
|
|
echo "issue-number=1" >> $GITHUB_OUTPUT; \
|
2020-05-01 19:33:30 +09:00
|
|
|
fi
|
2020-05-01 19:10:35 +09:00
|
|
|
|
|
|
|
test:
|
2020-05-13 17:20:12 +09:00
|
|
|
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository
|
2020-05-01 19:10:35 +09:00
|
|
|
needs: [build]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
target: [built, committed]
|
|
|
|
steps:
|
2023-09-06 05:47:37 +00:00
|
|
|
- uses: actions/checkout@v4
|
2020-05-03 11:51:07 +09:00
|
|
|
- if: matrix.target == 'built' || github.event_name == 'pull_request'
|
2023-12-20 09:00:53 +00:00
|
|
|
uses: actions/download-artifact@v4
|
2020-05-01 19:10:35 +09:00
|
|
|
with:
|
|
|
|
name: dist
|
|
|
|
path: dist
|
2020-06-02 18:33:54 +09:00
|
|
|
- if: matrix.target == 'built' || github.event_name == 'pull_request'
|
2023-12-20 09:00:53 +00:00
|
|
|
uses: actions/download-artifact@v4
|
2020-06-02 18:33:54 +09:00
|
|
|
with:
|
|
|
|
name: action.yml
|
|
|
|
path: .
|
2020-05-01 19:10:35 +09:00
|
|
|
|
|
|
|
- name: Test create comment
|
|
|
|
uses: ./
|
|
|
|
id: couc
|
|
|
|
with:
|
|
|
|
issue-number: ${{ needs.build.outputs.issue-number }}
|
|
|
|
body: |
|
|
|
|
This is a multi-line test comment
|
2020-06-08 08:38:27 +09:00
|
|
|
- With GitHub **Markdown** :sparkles:
|
2020-05-01 19:10:35 +09:00
|
|
|
- Created by [create-or-update-comment][1]
|
|
|
|
|
|
|
|
[1]: https://github.com/peter-evans/create-or-update-comment
|
|
|
|
reactions: '+1'
|
|
|
|
|
|
|
|
- name: Test update comment
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
comment-id: ${{ steps.couc.outputs.comment-id }}
|
|
|
|
body: |
|
|
|
|
**Edit:** Some additional info
|
|
|
|
reactions: eyes
|
2023-04-05 16:14:13 +09:00
|
|
|
reactions-edit-mode: replace
|
2020-05-01 19:10:35 +09:00
|
|
|
|
|
|
|
- name: Test add reactions
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
comment-id: ${{ steps.couc.outputs.comment-id }}
|
2023-04-05 16:14:13 +09:00
|
|
|
reactions: |
|
|
|
|
heart
|
|
|
|
hooray
|
|
|
|
laugh
|
2020-05-01 19:10:35 +09:00
|
|
|
|
2022-10-24 15:38:52 +09:00
|
|
|
- name: Test create comment from file
|
|
|
|
uses: ./
|
|
|
|
id: couc2
|
|
|
|
with:
|
|
|
|
issue-number: ${{ needs.build.outputs.issue-number }}
|
2023-04-05 16:14:13 +09:00
|
|
|
body-path: .github/comment-body.md
|
|
|
|
reactions: |
|
|
|
|
+1
|
2022-10-24 15:38:52 +09:00
|
|
|
|
|
|
|
- name: Test update comment from file
|
|
|
|
uses: ./
|
|
|
|
with:
|
|
|
|
comment-id: ${{ steps.couc2.outputs.comment-id }}
|
2023-04-05 16:14:13 +09:00
|
|
|
body-path: .github/comment-body-addition.md
|
|
|
|
append-separator: space
|
|
|
|
reactions: eyes, rocket
|
|
|
|
reactions-edit-mode: replace
|
2022-10-24 15:38:52 +09:00
|
|
|
|
2020-05-01 19:10:35 +09:00
|
|
|
package:
|
2021-05-12 17:18:15 +09:00
|
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
2020-05-01 19:10:35 +09:00
|
|
|
needs: [test]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2023-09-06 05:47:37 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-12-20 09:00:53 +00:00
|
|
|
- uses: actions/download-artifact@v4
|
2020-05-01 19:10:35 +09:00
|
|
|
with:
|
|
|
|
name: dist
|
|
|
|
path: dist
|
|
|
|
- name: Create Pull Request
|
2024-02-07 05:28:36 +00:00
|
|
|
uses: peter-evans/create-pull-request@v6
|
2020-05-01 19:10:35 +09:00
|
|
|
with:
|
2022-12-09 17:11:52 +09:00
|
|
|
token: ${{ secrets.ACTIONS_BOT_TOKEN }}
|
2020-05-01 19:10:35 +09:00
|
|
|
commit-message: Update distribution
|
|
|
|
title: Update distribution
|
|
|
|
body: |
|
2021-05-12 17:18:15 +09:00
|
|
|
- Updates the distribution for changes on `main`
|
2020-05-01 19:10:35 +09:00
|
|
|
|
|
|
|
Auto-generated by [create-pull-request][1]
|
|
|
|
|
|
|
|
[1]: https://github.com/peter-evans/create-pull-request
|
|
|
|
branch: update-distribution
|