Skip to content

Commit

Permalink
feat/fix: Update docker/login-action command in Gi
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Jan 18, 2024
1 parent 4fd2509 commit 86bb968
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit 86bb968

Please sign in to comment.