Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Remove defaultProps usages#114

Remove defaultProps usages

Remove defaultProps usages #114

Workflow file for this run

name:Check for repro
on:
issues:
types:[opened, edited, labeled]
issue_comment:
types:[created, edited]
jobs:
check-repro:
runs-on:ubuntu-latest
steps:
-uses:actions/github-script@v7
with:
github-token:${{ secrets.GITHUB_TOKEN }}
script:|
const user = context.payload.sender?.login;
const issue = context.payload.issue;
const comment = context.payload.comment;
const body = comment?.body || issue?.body || '';
const issueNumber = context.issue.number;
const owner = context.repo.owner;
const repo = context.repo.repo;
const reproRegex = new RegExp(
`https?:\\/\\/(?:github\\.com\\/${user}\\/[^\\s/]+\\/?|snack\\.expo\\.dev\\/[^\\s]+)`,
'i'
);
const hasRepro = reproRegex.test(body);
const addLabel = async (label) => {
await github.rest.issues.addLabels({
issue_number: issueNumber,
owner,
repo,
labels: [label],
});
};
const removeLabel = async (label) => {
try {
await github.rest.issues.removeLabel({
issue_number: issueNumber,
owner,
repo,
name: label,
});
} catch (error) {
if (!/Label does not exist/i.test(error.message)) {
throw error;
}
}
};
// Check if the issue has the "bug" label
const labels = issue?.labels?.map(label => label.name) || [];
const isBug = labels.includes('bug');
if (!isBug) {
return; // Exit if the issue is not labeled as "bug"
}
if (hasRepro) {
await addLabel('repro provided');
await removeLabel('needs repro');
return;
}
// Only comment if it's an issue (not just a comment update)
if (context.eventName !== 'issues') return;
const reminderComment = `Hey! Thanks for opening the issue. The issue doesn't seem to contain a link to a repro (a [snack.expo.dev](https://snack.expo.dev) link or link to a GitHub repo under your username). Can you provide a [minimal repro](https://stackoverflow.com/help/minimal-reproducible-example) which demonstrates the issue? A repro will help us debug the issue faster. Please try to keep the repro as small as possible and make sure that we can run it without additional setup.`;
const existingComments = await github.rest.issues.listComments({
issue_number: issueNumber,
owner,
repo,
});
const alreadyCommented = existingComments.data.some(c => c.body === reminderComment);
if (!alreadyCommented) {
await github.rest.issues.createComment({
issue_number: issueNumber,
owner,
repo,
body: reminderComment,
});
}
await addLabel('needs repro');

[8]ページ先頭

©2009-2025 Movatter.jp