Skip to content

Commit

Permalink
ci: remove conditional elses
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnisDa committed Sep 4, 2024
1 parent 46b611a commit ddb4c4d
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,31 +44,27 @@ jobs:
`name=${ghcrRegistry}/${owner}/${repositoryName}`
];
let shouldRun = 'false';
if (context.eventName === "push") {
core.setOutput('should-run', 'true');
shouldRun = 'true';
} else if (context.eventName === "pull_request") {
const commitMsg = await github.rest.repos.getCommit({
owner: context.repo.owner,
repo: context.repo.repo,
ref: context.payload.pull_request.head.sha
}).then(commit => commit.data.commit.message);
if (commitMsg.includes("Run CI")) {
core.setOutput('should-run', 'true');
shouldRun = 'true';
if (context.payload.pull_request.head.repo.full_name !== context.repo.full_name) {
imageNames.shift();
}
} else {
core.setOutput('should-run', 'false');
}
} else {
core.setOutput('should-run', 'false');
}
if (context.eventName === "push" && context.ref.startsWith("refs/tags/")) {
core.setOutput('should-release', 'true');
} else {
core.setOutput('should-release', 'false');
}
core.setOutput('should-run', shouldRun);
const shouldRelease = (context.eventName === "push" && context.ref.startsWith("refs/tags/")) ? 'true' : 'false';
core.setOutput('should-release', shouldRelease);
core.setOutput('image-names', imageNames.join('\n'));
Expand Down

0 comments on commit ddb4c4d

Please sign in to comment.