-
Notifications
You must be signed in to change notification settings - Fork 717
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from AlexanderLavelle/master
master into schemagenmod
- Loading branch information
Showing
439 changed files
with
55,810 additions
and
9,314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Copyright 2023 Google LLC. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
name: 'CSAT survey' | ||
on: | ||
issues: | ||
types: | ||
- closed | ||
|
||
permissions: | ||
contents: read | ||
issues: write | ||
pull-requests: write | ||
|
||
jobs: | ||
welcome: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const script = require('./\.github/workflows/scripts/csat.js') | ||
script({github, context}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
Copyright 2023 Google LLC. All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
let CONSTANT_VALUES = { | ||
GLOBALS: { | ||
LABELS: { | ||
STALE: 'stale', | ||
AWAITINGRES: 'stat:awaiting response', | ||
BUG: 'type:bug', | ||
BUG_INSTALL: 'type:build/install', | ||
TYPE_SUPPORT: 'type:support', | ||
TYPE_OTHER: 'type:others', | ||
TYPE_DOCS_BUG: 'type:docs-bug', | ||
TYPE_PERFORMANCE: 'type:performance' | ||
}, | ||
STATE: {CLOSED: 'closed'}, | ||
TENSORFLOW_CORE_REPO: 'https://github.com/tensorflow/tensorflow/pull', | ||
PR_TRIGGER_REPO: 'testRep,keras' | ||
}, | ||
MODULE: { | ||
CSAT: { | ||
YES: 'Yes', | ||
NO: 'No', | ||
BASE_URL: | ||
'https://docs.google.com/forms/d/e/1FAIpQLSfaP12TRhd9xSxjXZjcZFNXPG' + | ||
'k4kc1-qMdv3gc6bEP90vY1ew/viewform?', | ||
MEDIA_PIPE_BASE_URL: | ||
'https://docs.google.com/forms/d/e/1FAIpQLScOLT8zeBHummIZFnfr9wqvxYzWD1DAypyvNia5WVIWtFANYg/viewform?', | ||
SATISFACTION_PARAM: 'entry.85265664=', | ||
ISSUEID_PARAM: '&entry.2137816233=', | ||
MSG: 'Are you satisfied with the resolution of your issue?', | ||
} | ||
} | ||
|
||
}; | ||
module.exports = CONSTANT_VALUES; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
Copyright 2023 Google LLC. All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
const CONSTANT_VALUES = require('./constant'); | ||
|
||
/** | ||
* Invoked from stale_csat.js and csat.yaml file to post survey link | ||
* in closed issue. | ||
* @param {!Object.<string,!Object>} github contains pre defined functions. | ||
* context Information about the workflow run. | ||
* @return {null} | ||
*/ | ||
module.exports = async ({ github, context }) => { | ||
const issue = context.payload.issue.html_url; | ||
let baseUrl = ''; | ||
// Loop over all ths label present in issue and check if specific label is | ||
// present for survey link. | ||
for (const label of context.payload.issue.labels) { | ||
if (label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.BUG) || | ||
label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.BUG_INSTALL) || | ||
label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.TYPE_PERFORMANCE) || | ||
label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.TYPE_OTHER) || | ||
label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.TYPE_SUPPORT) || | ||
label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.TYPE_DOCS_BUG)) { | ||
console.log( | ||
`label-${label.name}, posting CSAT survey for issue =${issue}`); | ||
if (context.repo.repo.includes('mediapipe')) | ||
baseUrl = CONSTANT_VALUES.MODULE.CSAT.MEDIA_PIPE_BASE_URL; | ||
else | ||
baseUrl = CONSTANT_VALUES.MODULE.CSAT.BASE_URL; | ||
|
||
const yesCsat = `<a href="${baseUrl + CONSTANT_VALUES.MODULE.CSAT.SATISFACTION_PARAM + | ||
CONSTANT_VALUES.MODULE.CSAT.YES + | ||
CONSTANT_VALUES.MODULE.CSAT.ISSUEID_PARAM + issue}"> ${CONSTANT_VALUES.MODULE.CSAT.YES}</a>`; | ||
|
||
const noCsat = `<a href="${baseUrl + CONSTANT_VALUES.MODULE.CSAT.SATISFACTION_PARAM + | ||
CONSTANT_VALUES.MODULE.CSAT.NO + | ||
CONSTANT_VALUES.MODULE.CSAT.ISSUEID_PARAM + issue}"> ${CONSTANT_VALUES.MODULE.CSAT.NO}</a>`; | ||
const comment = CONSTANT_VALUES.MODULE.CSAT.MSG + '\n' + yesCsat + '\n' + | ||
noCsat + '\n'; | ||
let issueNumber = context.issue.number ?? context.payload.issue.number; | ||
await github.rest.issues.createComment({ | ||
issue_number: issueNumber, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: comment | ||
}); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
Copyright 2023 Google LLC. All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
const csat = require('./csat.js'); | ||
const CONSTANT = require('./constant.js'); | ||
|
||
/** | ||
* When stale bot closes the issue this function will | ||
* invoke and post CSAT link on the issue. | ||
* This function will fetch all the issues closed within 20 minutes and | ||
* post the survey link if survey link is not posted already. | ||
* @param {!Object.<string,!Object>} github contains pre defined functions. | ||
* context contains information about the workflow run. | ||
*/ | ||
module.exports = async ({github, context}) => { | ||
let date = new Date(); | ||
let totalMilliSeconds = date.getTime(); | ||
let minutes = 20; | ||
let millisecondsToSubtract = minutes * 60 * 1000; | ||
let closeTime = totalMilliSeconds - millisecondsToSubtract; | ||
let newDate = new Date(closeTime); | ||
let ISOCloseTime = newDate.toISOString(); | ||
let closeTimeIssues = await github.rest.issues.listForRepo({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
state: 'closed', | ||
labels: 'stale', | ||
since: ISOCloseTime | ||
}); | ||
let issueList = closeTimeIssues.data; | ||
for (let i = 0; i < issueList.length; i++) { | ||
if (issueList[i].node_id && issueList[i].node_id.indexOf('PR') != -1) | ||
continue; | ||
|
||
let comments = await github.rest.issues.listComments({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: issueList[i].number | ||
}); | ||
let noOfComments = comments.data.length; | ||
let lastComment = comments.data[noOfComments - 1]; | ||
let strCom = JSON.stringify(lastComment); | ||
if (strCom.indexOf(CONSTANT.MODULE.CSAT.MSG) == -1) { | ||
context.payload.issue = {}; | ||
context.payload.issue.number = issueList[i].number; | ||
context.payload.issue.labels = issueList[i].labels; | ||
context.payload.issue.html_url = issueList[i].html_url; | ||
await csat({github, context}); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,85 @@ | ||
name: Mark and close stale pull requests | ||
# Copyright 2023 Google LLC. All Rights Reserved. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# This workflow alerts and then closes the stale issues/PRs after specific time | ||
# You can adjust the behavior by modifying this file. | ||
# For more information, see: | ||
# https://github.com/actions/stale | ||
|
||
name: Mark and close stale PRs/issues | ||
|
||
on: | ||
schedule: | ||
- cron: "30 1 * * *" | ||
|
||
|
||
permissions: | ||
contents: read | ||
issues: write | ||
pull-requests: write | ||
|
||
jobs: | ||
stale: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/stale@v3.0.8 | ||
- uses: actions/stale@v7 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
#Comma separated list of labels that can be assigned to issues to exclude them from being marked as stale | ||
exempt-issue-labels: 'override-stale' | ||
#Comma separated list of labels that can be assigned to PRs to exclude them from being marked as stale | ||
exempt-pr-labels: "override-stale" | ||
#Limit the No. of API calls in one run default value is 30. | ||
operations-per-run: 1000 | ||
# Prevent to remove stale label when PRs or issues are updated. | ||
remove-stale-when-updated: true | ||
# List of labels to remove when issues/PRs unstale. | ||
labels-to-remove-when-unstale: 'stat:awaiting response' | ||
stale-pr-message: 'This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days' | ||
days-before-stale: 30 | ||
days-before-close: 5 | ||
|
||
#comment on PR if stale for more then 30 days. | ||
close-pr-message: This PR was closed due to lack of activity after being marked stale for past 30 days. | ||
|
||
# comment on issues if not active for more then 7 days. | ||
stale-issue-message: 'This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.' | ||
|
||
#comment on issues if stale for more then 7 days. | ||
close-issue-message: 'This issue was closed due to lack of activity after being marked stale for past 7 days.' | ||
|
||
# reason for closed the issue default value is not_planned | ||
close-issue-reason: completed | ||
|
||
# Number of days of inactivity before a stale issue is closed | ||
days-before-issue-close: 7 | ||
|
||
# Number of days of inactivity before an issue Request becomes stale | ||
days-before-issue-stale: 7 | ||
|
||
#Check for label to stale or close the issue/PR | ||
any-of-labels: 'stat:awaiting response' | ||
|
||
#stale label for PRs | ||
stale-pr-label: 'stale' | ||
|
||
#stale label for issues | ||
stale-issue-label: 'stale' | ||
- uses: actions/checkout@v3 | ||
- uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const script = require('./\.github/workflows/scripts/stale_csat.js') | ||
script({github, context}) |
Oops, something went wrong.