diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..de34c36 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,10 @@ +# These are supported funding model platforms + +github: [sassdawe] +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..1a7de41 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Sass, David + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/src/PowerShellToolRunner.ts b/src/PowerShellToolRunner.ts deleted file mode 100644 index c30eac8..0000000 --- a/src/PowerShellToolRunner.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { which } from '@actions/io'; -import { exec } from '@actions/exec'; - -export default class PowerShellToolRunner { - static psPath: string; - - static async init() { - if (!PowerShellToolRunner.psPath) { - PowerShellToolRunner.psPath = await which("powershell", true); - } - } - - static async executePowerShellScriptBlock(scriptBlock: string, options: any = {}): Promise { - const exitCode: number = await exec(`"${PowerShellToolRunner.psPath}" -NoLogo -NoProfile -NonInteractive -Command`, - [scriptBlock], options); - return exitCode; - } -} \ No newline at end of file diff --git a/src/main.ts b/src/main.ts deleted file mode 100644 index 57927f1..0000000 --- a/src/main.ts +++ /dev/null @@ -1,38 +0,0 @@ -import * as core from '@actions/core'; -import { existsSync } from 'fs'; -import PowerShellToolRunner from './PowerShellToolRunner'; - -async function main() { - try { - const adminUrl: string = core.getInput("SHAREPOINT_ADMIN_URL", { required: true }); - const clientID: string = core.getInput("CLIENT_ID", { required: true }); - const clientSecret: string = core.getInput("CLIENT_SECRET", { required: true }); -// const appFilePath: string = core.getInput("APP_FILE_PATH", { required: true }); -// const overwrite: string = core.getInput("OVERWRITE", { required: false }) == "true" ? "-Overwrite" : ""; -// const scope: string = core.getInput("SCOPE", { required: false }).toLowerCase() == "site" ? "Site" : "Tenant"; -// const skipFeatureDeployment: string = core.getInput("SKIP_FEATURE_DEPLOYMENT", { required: false }) == "true" ? "-SkipFeatureDeployment" : ""; - - //if (!existsSync(appFilePath)) { - // throw new Error("Please check if the app file path - APP_FILE_PATH - is correct."); - //} - - core.info("ℹī¸ Starting something..."); - - await PowerShellToolRunner.init(); - - const script = `$ErrorActionPreference = "Stop"; - $WarningPreference = "SilentlyContinue"; - Install-Module -Name SharePointPnPPowerShellOnline -Force -Verbose -Scope CurrentUser; - Connect-PnPOnline -Url ${adminUrl} -ClientId ${clientID} -ClientSecret ${clientSecret}; - (Get-PnPConnection).Url | Write-Output;`; - - await PowerShellToolRunner.executePowerShellScriptBlock(script); - - core.info("✅ Something is successful."); - } catch (err) { - core.error("🚨 Some error occurred"); - core.setFailed(err); - } -} - -main(); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 90492ff..c9dc134 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,15 @@ { - "compilerOptions": { - "module": "commonjs", - "esModuleInterop": true, - "target": "es6", - "moduleResolution": "node", - "rootDir": "./src" - }, - "lib": ["es2015"], - "exclude": ["node_modules"] - } \ No newline at end of file + "compilerOptions": { + "module": "commonjs", + "esModuleInterop": true, + "target": "es6", + "moduleResolution": "node", + "rootDir": "./dist" + }, + "lib": [ + "es2015" + ], + "exclude": [ + "node_modules" + ] +} \ No newline at end of file