Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions .github/scripts/constant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
Copyright 2026 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: {
BUG: 'bug',
DOCUMENTATION: 'documentation',
GOOD_FIRST_ISSUE: 'good first issue',
ENHANCEMENT: 'enhancement',
QUESTION: 'question',
JAVA: 'java',
SAMPLE: 'sample',
TESTING: 'testing',
CONTRIB: 'contrib',
DEPENDENCIES: 'dependencies',
DUPLICATE: 'duplicate',
GITHUB: 'github',
NEEDS_UPDATE: 'needs update',
READY_TO_PULL: 'ready to pull'
},
STATE: { CLOSED: 'closed' },
},
MODULE: {
CSAT: {
YES: 'Yes',
NO: 'No',
BASE_URL: 'https://docs.google.com/forms/d/e/1FAIpQLSeh96UhNq0-d4zdbKLj01Or56eqXom9iaw5sVquaB7Sno1SRg/viewform?usp=pp_url&',
SATISFACTION_PARAM: 'entry.885968193=',
ISSUEID_PARAM: '&entry.1737461264=',
MSG: 'Are you satisfied with the resolution of your issue?',
}
}

};
module.exports = CONSTANT_VALUES;
67 changes: 67 additions & 0 deletions .github/scripts/csat.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
Copyright 2026 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 csat_adkjava.yml 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;
const baseUrl = CONSTANT_VALUES.MODULE.CSAT.BASE_URL;

// 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.DOCUMENTATION) ||
label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.GOOD_FIRST_ISSUE) ||
label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.ENHANCEMENT) ||
label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.QUESTION) ||
label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.JAVA) ||
label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.SAMPLE) ||
label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.TESTING) ||
label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.CONTRIB) ||
label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.DEPENDENCIES) ||
label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.DUPLICATE) ||
label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.GITHUB) ||
label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.NEEDS_UPDATE) ||
label.name.includes(CONSTANT_VALUES.GLOBALS.LABELS.READY_TO_PULL)) {

console.log(`label-${label.name}, posting CSAT survey for issue =${issue}`);

const yesCsat = `<a href="${baseUrl + CONSTANT_VALUES.MODULE.CSAT.SATISFACTION_PARAM +
CONSTANT_VALUES.MODULE.CSAT.YES +
CONSTANT_VALUES.MODULE.CSAT.ISSUEID_PARAM + encodeURIComponent(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 + encodeURIComponent(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
});
}
}
};
21 changes: 21 additions & 0 deletions .github/workflows/csat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'CSAT survey for ADK-Java'
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/scripts/csat.js')
script({github, context})