mirror of
https://github.com/imjasonh/apidiff-action
synced 2026-07-06 22:52:43 +00:00
Test PR comment functionality
- Add pull-requests: write permission to CI workflow - Add test-pr-comment job that runs only on PRs - Enable comment-on-pr for breaking changes test - This will create a comment showing the API changes
This commit is contained in:
parent
6a27c8d063
commit
b00c6b7df0
2 changed files with 36 additions and 0 deletions
32
.github/workflows/ci.yml
vendored
32
.github/workflows/ci.yml
vendored
|
|
@ -8,6 +8,7 @@ on:
|
|||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write # Required for PR comments
|
||||
|
||||
jobs:
|
||||
pre-commit:
|
||||
|
|
@ -132,3 +133,34 @@ jobs:
|
|||
echo "Expected 0 compatible changes, got ${{ steps.test-clean.outputs.compatible-count }}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test PR comment functionality (only on PRs)
|
||||
test-pr-comment:
|
||||
if: github.event_name == 'pull_request'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: 'stable'
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
|
||||
- name: Build action
|
||||
run: |
|
||||
npm ci
|
||||
npm run build
|
||||
|
||||
# Test with breaking changes and PR comment enabled
|
||||
- name: Test PR comment with breaking changes
|
||||
uses: ./
|
||||
with:
|
||||
working-directory: testdata/break
|
||||
fail-on-breaking: false
|
||||
comment-on-pr: true
|
||||
env:
|
||||
INPUT_OLD: old
|
||||
INPUT_NEW: new
|
||||
|
|
|
|||
4
test-file.txt
Normal file
4
test-file.txt
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
This file is added to demonstrate the PR comment feature of apidiff-action.
|
||||
|
||||
When this PR is opened, the test-pr-comment job will run and create a comment
|
||||
showing the API changes detected in the testdata/break example.
|
||||
Loading…
Add table
Add a link
Reference in a new issue