Skip to content

Commit

Permalink
chore: do not run lint example on setup issues (rnmapbox#3233)
Browse files Browse the repository at this point in the history
  • Loading branch information
mfazekas authored Dec 4, 2023
1 parent ccd4103 commit 1db7847
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const Config = {
botLogin: 'github-actions[bot]',
/// the label to add when lint fails
label: 'error-in-code',
/// ignore issues with this label
ignoreLabels: ['bug-setup 🪲'],
/// this is the marker is added to all comments made by this action
commentMarker: '<!-- lint-action -->',
/// the comment prefix to add when lint fails
Expand Down Expand Up @@ -126,9 +128,29 @@ function log(...args) {
console.log('=>', ...args);
}

async function ignoreIssue(issueNumber, ignoreLabels) {
const token = core.getInput('repo-token') || process.env.GITHUB_TOKEN;
if (!token) {
console.error('No token found.');
}
const octokit = github.getOctokit(token);

const { data: labels } = await octokit.rest.issues.listLabelsOnIssue({
issue_number: issueNumber,
...github.context.repo,
});
const hasIgnoreLabel = labels.some((label) =>
ignoreLabels.includes(label.name),
);
return hasIgnoreLabel;
}

async function run() {
try {
const issueNumber = getIssueNumber();
if (await ignoreIssue(issueNumber, Config.ignoreLabels)) {
return;
}
const [code, { isTypescript = false }] = getCode();
if (!code) {
await processGithubIssue(
Expand Down

0 comments on commit 1db7847

Please sign in to comment.