Skip to content

Commit

Permalink
Release build 6.24.0 [ci release]
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanKingston authored and github-actions[bot] committed Oct 25, 2024
1 parent 6057273 commit b490a84
Show file tree
Hide file tree
Showing 40 changed files with 1,934 additions and 203 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/asana.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'asana sync'
on:
pull_request_review:
pull_request_target:
types:
- opened
- edited
- closed
- reopened
- synchronize
- review_requested

jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: sammacbeth/action-asana-sync@v6
with:
ASANA_ACCESS_TOKEN: ${{ secrets.ASANA_ACCESS_TOKEN }}
ASANA_WORKSPACE_ID: ${{ secrets.ASANA_WORKSPACE_ID }}
ASANA_PROJECT_ID: '1208598406046969'
USER_MAP: ${{ vars.USER_MAP }}
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ jobs:
- name: Fetch files and ensure branches exist
run: |
git fetch origin
if [ -f .git/shallow ]; then
echo "Shallow repo clone, unshallowing"
git fetch --unshallow
fi
git fetch --tags
# Check if the 'main' branch exists, if not, create it
if git rev-parse --verify main >/dev/null 2>&1; then
git checkout main
Expand All @@ -42,6 +47,7 @@ jobs:
run: |
ls -la ${{ github.workspace }}/CHANGELOG.txt
cat ${{ github.workspace }}/CHANGELOG.txt
echo "Current tag is: $(git rev-list --tags --max-count=1)"
- name: Checkout code from main into release branch
run: |
Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
- Move release debugging (#1155)
- Create asana.yml (#1159)
- Support conditional actions with expectations (#1144)
- Support a city/state composite value (#1158)
- ntp: customizer button (#1152)
- Add more debugging for tag release (#1156)
50 changes: 41 additions & 9 deletions Sources/ContentScopeScripts/dist/contentScopeIsolated.js
Original file line number Diff line number Diff line change
Expand Up @@ -7609,7 +7609,7 @@
/**
* @typedef {SuccessResponse | ErrorResponse} ActionResponse
* @typedef {{ result: true } | { result: false; error: string }} BooleanResult
* @typedef {{type: "element" | "text" | "url"; selector: string; parent?: string; expect?: string}} Expectation
* @typedef {{type: "element" | "text" | "url"; selector: string; parent?: string; expect?: string; failSilently?: boolean}} Expectation
*/

/**
Expand Down Expand Up @@ -11359,6 +11359,14 @@
results.push(setValueForInput(inputElem, generateRandomInt(parseInt(element.min), parseInt(element.max)).toString()));
} else if (element.type === '$generated_street_address$') {
results.push(setValueForInput(inputElem, generateStreetAddress()));

// This is a composite of existing (but separate) city and state fields
} else if (element.type === 'cityState') {
if (!Object.prototype.hasOwnProperty.call(data, 'city') || !Object.prototype.hasOwnProperty.call(data, 'state')) {
results.push({ result: false, error: `element found with selector '${element.selector}', but data didn't contain the keys 'city' and 'state'` });
continue
}
results.push(setValueForInput(inputElem, data.city + ', ' + data.state));
} else {
if (!Object.prototype.hasOwnProperty.call(data, element.type)) {
results.push({ result: false, error: `element found with selector '${element.selector}', but data didn't contain the key '${element.type}'` });
Expand Down Expand Up @@ -11719,21 +11727,45 @@

/**
* @param {Record<string, any>} action
* @param {Document | HTMLElement} root
* @return {import('../types.js').ActionResponse}
* @param {Record<string, any>} userData
* @param {Document} root
* @return {Promise<import('../types.js').ActionResponse>}
*/
function expectation (action, root = document) {
async function expectation (action, userData, root = document) {
const results = expectMany(action.expectations, root);

const errors = results.filter(x => x.result === false).map(x => {
if ('error' in x) return x.error
return 'unknown error'
});
// filter out good results + silent failures, leaving only fatal errors
const errors = results
.filter((x, index) => {
if (x.result === true) return false
if (action.expectations[index].failSilently) return false
return true
}).map((x) => {
return 'error' in x ? x.error : 'unknown error'
});

if (errors.length > 0) {
return new ErrorResponse({ actionID: action.id, message: errors.join(', ') })
}

// only run later actions if every expectation was met
const runActions = results.every(x => x.result === true);
const secondaryErrors = [];

if (action.actions?.length && runActions) {
for (const subAction of action.actions) {
const result = await execute(subAction, userData, root);

if ('error' in result) {
secondaryErrors.push(result.error);
}
}

if (secondaryErrors.length > 0) {
return new ErrorResponse({ actionID: action.id, message: secondaryErrors.join(', ') })
}
}

return new SuccessResponse({ actionID: action.id, actionType: action.actionType, response: null })
}

Expand Down Expand Up @@ -11875,7 +11907,7 @@
case 'click':
return click(action, data(action, inputData, 'userProfile'), root)
case 'expectation':
return expectation(action, root)
return await expectation(action, data(action, inputData, 'userProfile'), root)
case 'fillForm':
return fillForm(action, data(action, inputData, 'extractedProfile'), root)
case 'getCaptchaInfo':
Expand Down
50 changes: 41 additions & 9 deletions build/integration/contentScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -16256,7 +16256,7 @@
/**
* @typedef {SuccessResponse | ErrorResponse} ActionResponse
* @typedef {{ result: true } | { result: false; error: string }} BooleanResult
* @typedef {{type: "element" | "text" | "url"; selector: string; parent?: string; expect?: string}} Expectation
* @typedef {{type: "element" | "text" | "url"; selector: string; parent?: string; expect?: string; failSilently?: boolean}} Expectation
*/

/**
Expand Down Expand Up @@ -20002,6 +20002,14 @@
results.push(setValueForInput(inputElem, generateRandomInt(parseInt(element.min), parseInt(element.max)).toString()));
} else if (element.type === '$generated_street_address$') {
results.push(setValueForInput(inputElem, generateStreetAddress()));

// This is a composite of existing (but separate) city and state fields
} else if (element.type === 'cityState') {
if (!Object.prototype.hasOwnProperty.call(data, 'city') || !Object.prototype.hasOwnProperty.call(data, 'state')) {
results.push({ result: false, error: `element found with selector '${element.selector}', but data didn't contain the keys 'city' and 'state'` });
continue
}
results.push(setValueForInput(inputElem, data.city + ', ' + data.state));
} else {
if (!Object.prototype.hasOwnProperty.call(data, element.type)) {
results.push({ result: false, error: `element found with selector '${element.selector}', but data didn't contain the key '${element.type}'` });
Expand Down Expand Up @@ -20362,21 +20370,45 @@

/**
* @param {Record<string, any>} action
* @param {Document | HTMLElement} root
* @return {import('../types.js').ActionResponse}
* @param {Record<string, any>} userData
* @param {Document} root
* @return {Promise<import('../types.js').ActionResponse>}
*/
function expectation (action, root = document) {
async function expectation (action, userData, root = document) {
const results = expectMany(action.expectations, root);

const errors = results.filter(x => x.result === false).map(x => {
if ('error' in x) return x.error
return 'unknown error'
});
// filter out good results + silent failures, leaving only fatal errors
const errors = results
.filter((x, index) => {
if (x.result === true) return false
if (action.expectations[index].failSilently) return false
return true
}).map((x) => {
return 'error' in x ? x.error : 'unknown error'
});

if (errors.length > 0) {
return new ErrorResponse({ actionID: action.id, message: errors.join(', ') })
}

// only run later actions if every expectation was met
const runActions = results.every(x => x.result === true);
const secondaryErrors = [];

if (action.actions?.length && runActions) {
for (const subAction of action.actions) {
const result = await execute(subAction, userData, root);

if ('error' in result) {
secondaryErrors.push(result.error);
}
}

if (secondaryErrors.length > 0) {
return new ErrorResponse({ actionID: action.id, message: secondaryErrors.join(', ') })
}
}

return new SuccessResponse({ actionID: action.id, actionType: action.actionType, response: null })
}

Expand Down Expand Up @@ -20518,7 +20550,7 @@
case 'click':
return click(action, data(action, inputData, 'userProfile'), root)
case 'expectation':
return expectation(action, root)
return await expectation(action, data(action, inputData, 'userProfile'), root)
case 'fillForm':
return fillForm(action, data(action, inputData, 'extractedProfile'), root)
case 'getCaptchaInfo':
Expand Down
Loading

0 comments on commit b490a84

Please sign in to comment.