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
44 changes: 44 additions & 0 deletions .github/workflows/jf-gha-exp-callee.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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.title }}
with:
script: |
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