diff --git a/.github/workflows/check-changeset.yml b/.github/workflows/check-changeset.yml new file mode 100644 index 00000000000..9702855ae7d --- /dev/null +++ b/.github/workflows/check-changeset.yml @@ -0,0 +1,75 @@ +# ------------------------------------------------------------------------------------- +# +# Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). +# +# WSO2 LLC. licenses this file to you 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 will check if a submitted PR has changesets. + +name: 🦋 Check for Changeset + +on: + workflow_run: + workflows: ["Receive PR"] + types: + - completed + +env: + GH_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN }} + +jobs: + upload: + runs-on: ubuntu-latest + if: > + github.event.workflow_run.event == 'pull_request' && + github.event.workflow_run.conclusion == 'success' + steps: + - name: 'Download artifact' + uses: actions/github-script@v3.1.0 + with: + script: | + var artifacts = await github.actions.listWorkflowRunArtifacts({ + owner: context.repo.owner, + repo: context.repo.repo, + run_id: ${{ github.event.workflow_run.id }}, + }); + var matchArtifact = artifacts.data.artifacts.filter((artifact) => { + return artifact.name == "pr" + })[0]; + var download = await github.actions.downloadArtifact({ + owner: context.repo.owner, + repo: context.repo.repo, + artifact_id: matchArtifact.id, + archive_format: 'zip', + }); + var fs = require('fs'); + fs.writeFileSync('${{github.workspace}}/pr.zip', Buffer.from(download.data)); + - run: unzip pr.zip + + - name: 'Comment on PR' + uses: actions/github-script@v3 + with: + github-token: ${{ env.GH_TOKEN }} + script: | + var fs = require('fs'); + var issue_number = Number(fs.readFileSync('./NR')); + await github.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: issue_number, + body: 'Everything is OK. Thank you for the PR!' + }); diff --git a/.github/workflows/receive-pr.yml b/.github/workflows/receive-pr.yml new file mode 100644 index 00000000000..7ea4d40609e --- /dev/null +++ b/.github/workflows/receive-pr.yml @@ -0,0 +1,47 @@ +# ------------------------------------------------------------------------------------- +# +# Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). +# +# WSO2 LLC. licenses this file to you 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: Receive PR + +on: + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + # imitation of a build process + - name: Build + run: | + echo "Building..." + sleep 100 + echo "Done!" + - name: Save PR number + run: | + mkdir -p ./pr + echo ${{ github.event.number }} > ./pr/NR + - uses: actions/upload-artifact@v2 + with: + name: pr + path: pr/ diff --git a/apps/console/src/features/application-roles/components/application-role-invited-user-groups.tsx b/apps/console/src/features/application-roles/components/application-role-invited-user-groups.tsx index e01d1679d95..a98abbf7dce 100644 --- a/apps/console/src/features/application-roles/components/application-role-invited-user-groups.tsx +++ b/apps/console/src/features/application-roles/components/application-role-invited-user-groups.tsx @@ -1,5 +1,5 @@ /** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. + * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -77,8 +77,8 @@ const ApplicationRoleInvitedUserGroups = (props: ApplicationRoleGroupsProps): Re error: descendantDataFetchRequestError } = useDescendantsOfSubOrg(); - useEffect(() => { - if (originalApplicationRoleGroupData instanceof IdentityAppsApiException + useEffect(() => { + if (originalApplicationRoleGroupData instanceof IdentityAppsApiException || applicationRoleGroupDataFetchRequestError) { handleAlerts({ description: t( @@ -92,8 +92,8 @@ const ApplicationRoleInvitedUserGroups = (props: ApplicationRoleGroupsProps): Re } }, [ originalApplicationRoleGroupData ]); - useEffect(() => { - if (originalDescendantData instanceof IdentityAppsApiException + useEffect(() => { + if (originalDescendantData instanceof IdentityAppsApiException || descendantDataFetchRequestError) { handleAlerts({ description: t( @@ -155,11 +155,11 @@ const ApplicationRoleInvitedUserGroups = (props: ApplicationRoleGroupsProps): Re if (query === "") { setProcessedGroupsList(initialGroupsList); - + return; } - const filteredGroupsList: ApplicationRoleGroupInterface[] = + const filteredGroupsList: ApplicationRoleGroupInterface[] = initialGroupsList.filter((group: ApplicationRoleGroupInterface) => { return group.name.toLowerCase().includes(query.toLowerCase()); }); @@ -213,7 +213,7 @@ const ApplicationRoleInvitedUserGroups = (props: ApplicationRoleGroupsProps): Re return null; }; - + /** * Resolves data table columns. */ @@ -314,7 +314,7 @@ const ApplicationRoleInvitedUserGroups = (props: ApplicationRoleGroupsProps): Re data-componentid={ `${ componentId }-groups-list-search-input` } icon={ } iconPosition="left" - onChange={ (e: ChangeEvent) => + onChange={ (e: ChangeEvent) => searchGroups(e.target.value) } value={ searchQuery } placeholder={ t("extensions:console.applicationRoles.roleGroups." + diff --git a/apps/console/src/features/application-roles/components/application-roles-list.tsx b/apps/console/src/features/application-roles/components/application-roles-list.tsx index f02360e9991..a61acb9d087 100644 --- a/apps/console/src/features/application-roles/components/application-roles-list.tsx +++ b/apps/console/src/features/application-roles/components/application-roles-list.tsx @@ -1,5 +1,5 @@ /** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. + * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -74,7 +74,7 @@ export const ApplicationRolesList = (props: ApplicationRolesListProps): ReactEle * * @returns placeholder component. */ - const showPlaceholders = (): ReactElement => { + const showPlaceholders = (): ReactElement => { // When the search returns empty. if (searchQuery && roleList?.length === 0) { return ( @@ -128,7 +128,7 @@ export const ApplicationRolesList = (props: ApplicationRolesListProps): ReactEle /** * Handle expand accordion title. - * + * * @param appRole - Application role. */ const handleAccordionTitleClick = ( @@ -150,9 +150,9 @@ export const ApplicationRolesList = (props: ApplicationRolesListProps): ReactEle /** * Renders the application roles list. - * + * * @param roles - Role list. - * + * * @returns Role list component. */ const resolveApplicationRolesList = (filteredApplicationRoles: ApplicationRoleInterface[]): ReactElement => { @@ -174,8 +174,8 @@ export const ApplicationRolesList = (props: ApplicationRolesListProps): ReactEle active={ expandedAssignedApplications?.includes(application.app) } accordionIndex={ application.app } className="nested-list-accordion-title mb-2 mt-1" - onClick={ - () => + onClick={ + () => handleAccordionTitleClick( application, expandedAssignedApplications, @@ -224,7 +224,7 @@ export const ApplicationRolesList = (props: ApplicationRolesListProps): ReactEle - { + { resolveApplicationRolesList( roleList ) diff --git a/apps/console/src/features/application-roles/components/assign-group-wizard.tsx b/apps/console/src/features/application-roles/components/assign-group-wizard.tsx index 5992e95aa24..eb515b07225 100644 --- a/apps/console/src/features/application-roles/components/assign-group-wizard.tsx +++ b/apps/console/src/features/application-roles/components/assign-group-wizard.tsx @@ -1,5 +1,5 @@ /** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. + * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -95,7 +95,7 @@ const AssignGroupWizard = (props: AssignGroupProps): ReactElement => { }; const filterOutExistingGroupsFromAllGroups = ( - allGroups: RolesInterface[], + allGroups: RolesInterface[], existingGroups: ApplicationRoleGroupInterface[] ) => { const filteredGroups: RolesInterface[] = []; @@ -104,13 +104,13 @@ const AssignGroupWizard = (props: AssignGroupProps): ReactElement => { allGroups.forEach((item: RolesInterface) => { const itemIndex: number = existingGroups.findIndex( (existingGroup: ApplicationRoleGroupInterface) => existingGroup?.name === item?.displayName); - + // No matching index found. if (itemIndex === -1) { filteredGroups.push(item); } }); - + setGroupsList(filteredGroups); setInitialGroupList(filteredGroups); } @@ -118,13 +118,13 @@ const AssignGroupWizard = (props: AssignGroupProps): ReactElement => { const assignGroupsToRole = () => { const selectedGroups: ApplicationRoleGroupInterface[] = []; - + tempGroupList.forEach((group: RolesInterface) => { selectedGroups.push({ name: group.displayName }); }); - + handleGroupAdd(selectedGroups); }; @@ -172,7 +172,7 @@ const AssignGroupWizard = (props: AssignGroupProps): ReactElement => { * The following method handles the onChange event of the * checkbox field of an unassigned item. */ - const handleUnassignedItemCheckboxChange = (group: RolesInterface) => { + const handleUnassignedItemCheckboxChange = (group: RolesInterface) => { const checkedGroups: RolesInterface[] = [ ...checkedUnassignedListItems ]; if (checkedGroups?.includes(group)) { @@ -231,7 +231,7 @@ const AssignGroupWizard = (props: AssignGroupProps): ReactElement => { { - !isLoading + !isLoading ? ( { style={ { height: "100%" } } handleItemChange={ () => handleUnassignedItemCheckboxChange(group) } key={ index } - listItem={ groupName?.length > 1 + listItem={ groupName?.length > 1 ? groupName[1] : group?.displayName } listItemId={ group.id } listItemIndex={ index } @@ -282,7 +282,7 @@ const AssignGroupWizard = (props: AssignGroupProps): ReactElement => { ) : ( - ) + ) } diff --git a/apps/console/src/features/application-roles/components/edit-application-role.tsx b/apps/console/src/features/application-roles/components/edit-application-role.tsx index 5eba8cddf2e..4335f48f0a9 100644 --- a/apps/console/src/features/application-roles/components/edit-application-role.tsx +++ b/apps/console/src/features/application-roles/components/edit-application-role.tsx @@ -1,5 +1,5 @@ /** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. + * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -41,7 +41,7 @@ const EditApplicationRoles = (props: EditApplicationRolesProps): ReactElement => const [ activeTabIndex, setActiveTabIndex ] = useState(undefined); const defaultActiveIndex: number = 0; - + const extendedFeatureConfig: ExtendedFeatureConfigInterface = useSelector( (state: AppState) => state.config.ui.features); const isSubOrg: boolean = window[ "AppUtils" ].getConfig().organizationName; @@ -102,7 +102,7 @@ const EditApplicationRoles = (props: EditApplicationRolesProps): ReactElement => } ); } - + return panes; }; diff --git a/apps/console/src/features/application-roles/components/index.ts b/apps/console/src/features/application-roles/components/index.ts index 7ac9d5244eb..9de9d1f3a65 100644 --- a/apps/console/src/features/application-roles/components/index.ts +++ b/apps/console/src/features/application-roles/components/index.ts @@ -1,5 +1,5 @@ /** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. + * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except diff --git a/apps/console/src/features/application-roles/components/roles-list.tsx b/apps/console/src/features/application-roles/components/roles-list.tsx index 945304ce083..5f9af3a795c 100644 --- a/apps/console/src/features/application-roles/components/roles-list.tsx +++ b/apps/console/src/features/application-roles/components/roles-list.tsx @@ -1,5 +1,5 @@ /** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. + * Copyright (c) 2024, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -59,7 +59,7 @@ const RolesList = (props: RolesListProps): ReactElement => { if (query === "") { setProcessedRolesList(rolesList); - + return; } @@ -125,7 +125,7 @@ const RolesList = (props: RolesListProps): ReactElement => { return null; }; - + /** * Resolves data table columns. diff --git a/apps/console/src/features/parent-roles/parent-roles.tsx b/apps/console/src/features/parent-roles/parent-roles.tsx index 17ed2ececc7..de5b535f6fb 100644 --- a/apps/console/src/features/parent-roles/parent-roles.tsx +++ b/apps/console/src/features/parent-roles/parent-roles.tsx @@ -1,5 +1,5 @@ /** - * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). All Rights Reserved. + * Copyright (c) 2023, WSO2 LLC. (https://www.wso2.com). * * WSO2 LLC. licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except @@ -72,7 +72,7 @@ const ParentRolePage = (props: ParentRolePagePropsInterface): ReactElement => { primaryAction={ t("common:configure") } >