Skip to content

Commit

Permalink
Modifies permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesIves committed Apr 26, 2022
1 parent bd8e5da commit d34d41a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ jobs:
integration-container,
integration-ssh,
integration-ssh-third-party-client,
integration-env
integration-env,
]
runs-on: ubuntu-latest
steps:
Expand Down
5 changes: 2 additions & 3 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,8 @@ export const action: ActionInterface = {
? getInput('git-config-email')
: pusher && pusher.email
? pusher.email
: `${
process.env.GITHUB_ACTOR || 'github-pages-deploy-action'
}@users.noreply.${
: `${process.env.GITHUB_ACTOR ||
'github-pages-deploy-action'}@users.noreply.${
process.env.GITHUB_SERVER_URL
? stripProtocolFromUrl(process.env.GITHUB_SERVER_URL)
: 'github.com'
Expand Down
14 changes: 9 additions & 5 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,15 @@ export async function deploy(action: ActionInterface): Promise<Status> {
await generateWorktree(action, temporaryDeploymentDirectory, branchExists)

/* Relaxes permissions of folder due to be deployed so rsync can write to/from it. */
await execute(
`chmod -R +rw ${action.folderPath}`,
action.workspace,
action.silent
)
try {
await execute(
`chmod -R +rw ${action.folderPath}`,
action.workspace,
action.silent
)
} catch {
info(`Unable to modify permissions鈥)
}

// Ensures that items that need to be excluded from the clean job get parsed.
let excludes = ''
Expand Down
9 changes: 6 additions & 3 deletions src/ssh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ export async function configureSSH(action: ActionInterface): Promise<void> {
appendFileSync(sshKnownHostsDirectory, sshGitHubKnownHostDss)

// Initializes SSH agent.
const agentOutput = execFileSync('ssh-agent').toString().split('\n')
const agentOutput = execFileSync('ssh-agent')
.toString()
.split('\n')

agentOutput.map(line => {
const exportableVariables =
/^(SSH_AUTH_SOCK|SSH_AGENT_PID)=(.*); export \1/.exec(line)
const exportableVariables = /^(SSH_AUTH_SOCK|SSH_AGENT_PID)=(.*); export \1/.exec(
line
)

if (exportableVariables && exportableVariables.length) {
exportVariable(exportableVariables[1], exportableVariables[2])
Expand Down
6 changes: 3 additions & 3 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ export const suppressSensitiveInformation = (
return value
}

const orderedByLength = (
[action.token, action.repositoryPath].filter(Boolean) as string[]
).sort((a, b) => b.length - a.length)
const orderedByLength = ([action.token, action.repositoryPath].filter(
Boolean
) as string[]).sort((a, b) => b.length - a.length)

for (const find of orderedByLength) {
value = replaceAll(value, find, '***')
Expand Down

0 comments on commit d34d41a

Please sign in to comment.