Comments (1)
This is something that I'd also like to see.
I'd like to add a review comment on Github for each commit that is not linked to an issue, but for that I also need to provide a path to a file that has been changed in that commit (see: https://docs.github.com/en/rest/pulls/comments?apiVersion=2022-11-28#create-a-review-comment-for-a-pull-request). For this usecase it doesn't really matter which file I'm putting the comment on.
A review comment is a bit better in this case than danger's message
because the PR can't be merged until all review comments are resolved.
I'd like to write a dangerfile like this:
import { danger } from "danger";
const ISSUE_REFERENCE = `https://github.com/${danger.github.thisPR.owner}/${danger.github.thisPR.repo}/issues/`;
danger.git.commits.forEach((commit) => {
if (!commit.message.includes(ISSUE_REFERENCE)) {
danger.github.api.pulls.createReviewComment({
owner: danger.github.thisPR.owner,
repo: danger.github.thisPR.repo,
pull_number: danger.github.thisPR.number,
commit_id: commit.sha,
body: "question: Do these changes belong to an issue?\n\nIf so, please add a reference to the issue in the commit messages.",
path: commit.modified_files[0], // <--- note this
side: "RIGHT",
subject_type: "file",
});
}
});
from danger-js.
Related Issues (20)
- [DEPS] Move from @gitbeaker/node to @gitbeaker/rest HOT 3
- [BUG] Danger taking comments as modified files HOT 6
- [BUG] process.env - Cannot read properties of undefined (reading 'env') HOT 1
- [BUG] substr is deprecated HOT 2
- [BUG] Danger.js comments removed from Github PR after merge HOT 5
- [BUG] [Gitlab] Can't post multiple inline comments HOT 1
- [BUG] Upgrading to danger `11.3.0` causes `tsc` build errors HOT 4
- [BUG] Include dangerfile.ts in the tsconfig makes tsc run out of memory HOT 2
- [BUG][Spec] GitHubReviewers interface is not described
- [BUG] Danger fails to create inline comments on Gitlab
- [BUG] Danger posting separate comment for each warning on GitHub HOT 2
- GHCR publishing is broken HOT 3
- [BUG] GitHubAPIPR unsupported structure HOT 2
- [BUG] `parent_ids` of GitLab MR commits is always an empty array HOT 2
- [BUG] `message` does not attach to a file and line provided, and instead all comments are in the "main comment" section HOT 1
- [Feature Request] Support ignoring whitespace-only changes HOT 3
- [BUG] prettier.resolveConfig fails due to faulty shouldUseGitHubOverride HOT 8
- [BUG] Can you push updated images to dockerhub? HOT 4
- [BUG] Commit status check associated with the wrong commit in CircleCI + GitHub combination HOT 2
- [Config Issue] GitHub Merge Queue - Danger server stuck in "waiting for status be reported" HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from danger-js.