chore: [wip] test ci #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR Changeset Check | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
jobs: | |
check_changeset: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Changed Files | |
id: changed-files | |
uses: tj-actions/[email protected] | |
with: | |
files: | | |
.changeset/**.md | |
- name: Check for major changes | |
id: check_changeset | |
env: | |
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} | |
run: | | |
files=$ALL_CHANGED_FILES | |
echo "File list: $files" | |
if grep -q "major" "$files"; then | |
major_changes=$(grep "major" $files) | |
echo "Found major changes." | |
echo "comment=$major_changes" >> $GITHUB_OUTPUT | |
else | |
echo "Not found major changes." | |
comment="" | |
echo "comment=$comment" >> $GITHUB_OUTPUT | |
fi | |
- name: Add label | |
if: ${{ steps.check_changeset.outputs.comment != '' }} | |
uses: actions-cool/issues-helper@v3 | |
with: | |
actions: 'add-labels' | |
issue-number: ${{ github.event.pull_request.number }} | |
labels: 'major' | |
- name: update status comment | |
if: ${{ steps.check_changeset.outputs.comment != '' }} | |
uses: actions-cool/maintain-one-comment@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
body: | | |
@${{ github.actor }}, 本次 PR 的更改包含 major 变更,请确认是否符合预期。 | |
___ | |
@${{ github.actor }}, this PR contains major changes, please confirm if it is as expected. | |
```md | |
${{ steps.check_changeset.outputs.comment }} | |
``` | |
<!-- AUTO_CHANGESET_CHECK_HOOK --> | |
body-include: '<!-- AUTO_CHANGESET_CHECK_HOOK -->' | |
number: ${{ github.event.pull_request.number }} | |
- name: Delete comment | |
if: ${{ steps.check_changeset.outputs.comment == '' }} | |
uses: actions-cool/maintain-one-comment@v3 | |
with: | |
body-include: '<!-- AUTO_CHANGESET_CHECK_HOOK -->' | |
number: ${{ github.event.pull_request.number }} | |
delete: true | |
- name: Remove labels | |
if: ${{ steps.check_changeset.outputs.comment == '' }} | |
uses: actions-cool/issues-helper@v3 | |
with: | |
actions: 'remove-labels' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
issue-number: ${{ github.event.pull_request.number }} | |
labels: 'major' |