forked from n8n-io/n8n
-
Notifications
You must be signed in to change notification settings - Fork 0
31 lines (24 loc) · 1.12 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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);