Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update detect translation conflicts action #431

Merged
merged 13 commits into from
Aug 15, 2024
Prev Previous commit
Next Next commit
I hate js
Furrior committed Aug 15, 2024
commit 4071e72511ec14002b5d856f637e5fb01f846584
50 changes: 25 additions & 25 deletions .github/workflows/detect_translate_conflicts.yml
Original file line number Diff line number Diff line change
@@ -42,31 +42,31 @@ jobs:
uses: actions/github-script@v7
with:
script: |
const { MERGE_CONFLICTS } = process.env;
const conflict_message_header = "This PR causes following conflicts on translate branch:\n";
const issue_body = `${conflict_message_header}${MERGE_CONFLICTS}`;
const { MERGE_CONFLICTS } = process.env;
const conflict_message_header = "This PR causes following conflicts on translate branch:\n";
const issue_body = `${conflict_message_header}${MERGE_CONFLICTS}`;

const comments = await github.rest.issues.listComments({
context.repo.owner,
context.repo.repo,
context.issue.number,
});
const comments = await github.rest.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
});

const action_comment = comments.data.find(comment => comment.body.includes(conflict_message_header) && comment.user.login === "github-actions[bot]");
if (action_comment) {
const comment_id = action_comment.id;
const action_comment = comments.data.find(comment => comment.body.startsWith(conflict_message_header) && comment.user.login === "github-actions[bot]");
if (action_comment) {
const comment_id = action_comment.id;

await github.rest.issues.updateComment({
context.repo.owner,
context.repo.repo,
comment_id: comment_id,
body: issue_body,
});
} else {
await github.rest.issues.createComment({
context.repo.owner,
context.repo.repo,
issue_number,
body: issue_body,
});
}
await github.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: comment_id,
body: issue_body,
});
} else {
await github.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: issue_body,
});
}