From 86bb96845340642e19c01e097c128a027f36d5b9 Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Thu, 18 Jan 2024 02:29:08 +0000 Subject: [PATCH] feat/fix: Update docker/login-action command in Gi --- .github/workflows/main.yml | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000000000..e83863590f250 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,31 @@ +// main.ts + +import * as fs from 'fs'; + +function updateDockerLoginAction(username: string, password: string): void { + const workflowFilePath = '.github/workflows/main.yml'; + const workflowFileContent = fs.readFileSync(workflowFilePath, 'utf8'); + + // Update the "docker/login-action@v2" command with the provided username and password + const updatedWorkflowFileContent = workflowFileContent.replace( + 'docker/login-action@v2', + `docker/login-action@v2\n with:\n username: ${{ secrets.DOCKER_USERNAME }}\n password: ${{ secrets.DOCKER_PASSWORD }}` + ); + + fs.writeFileSync(workflowFilePath, updatedWorkflowFileContent); +} + +function storeSecret(name: string, value: string): void { + // Store the secret securely + // Implementation details depend on the platform being used + // For example, in GitHub Actions, you can use the `actions/secrets` package + // to store the secret as a repository secret +} + +// Usage example +const username = 'your_username'; +const password = 'your_password'; + +storeSecret('DOCKER_USERNAME', username); +storeSecret('DOCKER_PASSWORD', password); +updateDockerLoginAction(username, password);