Skip to content

Commit

Permalink
Merge branch 'develop' into dependabot/npm_and_yarn/follow-redirects-…
Browse files Browse the repository at this point in the history
…1.15.4
  • Loading branch information
CristiCanizales authored Jun 18, 2024
2 parents af00259 + 241652b commit 2117f6e
Show file tree
Hide file tree
Showing 687 changed files with 15,325 additions and 9,800 deletions.
6 changes: 3 additions & 3 deletions .git2gus/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@
"area:xml": "a1aB0000000BPyKIAW"
},
"issueTypeLabels": {
"type:feature": "",
"feature": "USER STORY",
"type:bug": "BUG P3",
"type:security": "BUG P2",
"type:feedback": "",
"type:duplicate": "",
"status:duplicate": "",
"type:community-contrib": "USER STORY"
},
"defaultBuild": "offcore.tooling.58",
"defaultBuild": "offcore.tooling.61",
"hideWorkItemUrl": "true",
"statusWhenClosed": "CLOSED"
}
6 changes: 4 additions & 2 deletions .github/ISSUE_TEMPLATE/Bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ NOTICE: While GitHub is the preferred channel for reporting issues/feedback, thi
-->

<!--
FOR BUGS RELATED TO THE SALEFORCE CLI, please use this repository: https://github.com/forcedotcom/cli
FOR BUGS RELATED TO THE SALESFORCE CLI, please use this repository: https://github.com/forcedotcom/cli
-->

### Summary
Expand All @@ -38,8 +38,10 @@ _Feel free to attach a screenshot_.

**Salesforce Extension Version in VS Code**:

**SFDX CLI Version**:
**Salesforce CLI Version**:

**OS and version**:

**VS Code version**:

**Most recent version of the extensions where this was working**:
17 changes: 17 additions & 0 deletions .github/actions/check-feature-request/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# Copyright (c) 2024, salesforce.com, inc.
# All rights reserved.
# Licensed under the BSD 3-Clause license.
# For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
#

name: 'Salesforce Extensions Check Feature Request Bot'
description: 'Check if a newly created Github issue is a feature request.'
author: 'Daphne Yang'
inputs:
repo-token:
required: true
description: 'Token taken from secrets env var'
runs:
using: 'node20'
main: 'lib/src/index.js'
2 changes: 2 additions & 0 deletions .github/actions/check-feature-request/lib/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 91 additions & 0 deletions .github/actions/check-feature-request/lib/src/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/actions/check-feature-request/lib/src/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

106 changes: 106 additions & 0 deletions .github/actions/check-feature-request/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
* Copyright (c) 2024, salesforce.com, inc.
* All rights reserved.
* Licensed under the BSD 3-Clause license.
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

import { getInput, setFailed } from "@actions/core";
import { context, getOctokit } from "@actions/github";

async function run() {
try {
const issue = context.payload.issue;

if (!issue) {
setFailed("github.context.payload.issue does not exist");
return;
}

// Temporary check to prevent this action from running on old issues
// This will prevent noise on tickets already being investigated
// This can be removed once the action has been running for a while
const creationDate = new Date(issue.created_at);
const cutoffDate = new Date("2023-06-14T00:00:00Z");
if (creationDate < cutoffDate) {
console.log("Issue was created before 6/14/2023, skipping");
return;
}

// Create a GitHub client
const token = getInput("repo-token");
const octokit = getOctokit(token);

// Get owner and repo from context
const owner = context.repo.owner;
const repo = context.repo.repo;
const issue_number = issue.number;

console.log("Issue URL:", issue.html_url);

const { body } = issue;
const { login: author } = issue.user;
const { data: comments } = await getAllComments();

// For version checks, we only care about comments from the author
const authorComments = comments.filter(
(comment) => comment?.user?.login === author
);
// Build an array of the issue body and all of the comment bodies
const bodies = [
body,
...authorComments.map((comment) => comment.body),
].filter((body): body is string => body !== undefined);
console.log('bodies = ' + JSON.stringify(bodies));
console.log('bodies.length = ' + bodies.length);

const core = require('@actions/core');
if (bodies[0] === null) {
core.setOutput("is_feature_request", "false");
} else {
const featureRequestRegex = /(feature\s*request)/ig;

// Search all bodies and get an array of all versions found (first capture group)
const featureRequests = bodies
.map((body) =>
[...body.matchAll(featureRequestRegex)].map((match) => match[1])
)
.flat();

if (featureRequests.length > 0) {
console.log('This issue is a feature request!');
addLabel("type:enhancements");
core.setOutput("is_feature_request", "true");
} else {
core.setOutput("is_feature_request", "false");
}
}

// ---------
// FUNCTIONS
// ---------

async function getAllComments() {
return await octokit.rest.issues.listComments({
owner,
repo,
issue_number,
});
}

async function addLabel(label: string) {
await octokit.rest.issues.addLabels({
owner,
repo,
issue_number,
labels: [label],
});
}

} catch (err) {
const error = err as Error;
setFailed(error.message);
}
}

run();
9 changes: 9 additions & 0 deletions .github/actions/check-feature-request/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"extends": "../../../tsconfig.common.json",
"compilerOptions": {
"outDir": "./lib"
},
"files": [
"src/index.ts"
]
}
23 changes: 23 additions & 0 deletions .github/actions/new-issue/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Copyright (c) 2024, salesforce.com, inc.
# All rights reserved.
# Licensed under the BSD 3-Clause license.
# For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
#

name: 'Salesforce Extensions New Issues Bot'
description: 'Send an automatic response to newly created Github issues.'
author: 'Daphne Yang'
inputs:
repo-token:
required: true
description: 'Token taken from secrets env var'
message:
required: true
description: 'Message to post in issue comment'
label:
required: false
description: 'A label the issue must contain to post the message'
runs:
using: 'node20'
main: 'lib/src/index.js'
2 changes: 2 additions & 0 deletions .github/actions/new-issue/lib/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export {};
//# sourceMappingURL=index.d.ts.map
1 change: 1 addition & 0 deletions .github/actions/new-issue/lib/src/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions .github/actions/new-issue/lib/src/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .github/actions/new-issue/lib/src/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2117f6e

Please sign in to comment.