镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions .github/workflows/jf-gha-exp-callee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: jf-gha-exp.yml
on:
workflow_call:

jobs:
read-comments:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Add a comment to the PR
uses: actions/github-script@v7
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
with:
script: |
const { data: repo } = await github.rest.repos.get({
owner: context.repo.owner,
repo: context.repo.repo,
});
console.log(`squashing? ${repo.allow_squash_merge}`);
core.info(`allow_squash_merge: ${repo.allow_squash_merge}`);
core.setOutput('squash_enabled', repo.allow_squash_merge);
const roboCommentBody = "This PR lacks any commits of the 'fix' or 'feat' type, and therefore will not trigger a release. To silence all further warnings, react to this warning comment (or any other) with the :eyes: emoji.";
const commits = await github.paginate(github.rest.pulls.listCommits, {
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: Number(process.env.PR_NUMBER),
per_page: 100
});
const hasFixOrFeatCommits = commits.some(c => {
return c.commit.message.startsWith('fix') || c.commit.message.startsWith('feat');
});
const comments = await github.paginate(github.rest.issues.listComments, {
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: Number(process.env.PR_NUMBER)
});
const hasAcknowledgedRoboComment = comments.some(comment => {
return comment.user.type === 'Bot'
&& comment.body === roboCommentBody
&& comment.reactions.eyes > 0
});
if (!hasFixOrFeatCommits && !hasAcknowledgedRoboComment) {
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: Number(process.env.PR_NUMBER),
body: roboCommentBody
});
}
8 changes: 8 additions & 0 deletions .github/workflows/jf-gha-exp-caller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: jf-gha-caller.yml
on:
pull_request:
types: [opened, edited, synchronize]

jobs:
call-callee:
uses: ./.github/workflows/jf-gha-exp-callee.yml
Loading