Skip to content

Commit

Permalink
Merge pull request #542 from Tradeshift/POPS-3158_add_support_on_sche…
Browse files Browse the repository at this point in the history
…duled_workflows

fix: add tag with prefix support on schedule GHA
  • Loading branch information
arminioa authored Jan 17, 2024
2 parents 75bb8c0 + 895af75 commit ba83ffb
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
1 change: 0 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ inputs:
based on the type of build: on master or on pull rquest.
An image built from a pull request is tagged with pr-<number>-<SHA>.
An image built on merge to master branch is tagged with master-<SHA>.
default: "true"
useqemu:
required: false
description: >
Expand Down
6 changes: 4 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

8 changes: 6 additions & 2 deletions src/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,12 @@ async function getSHATagWithPrefix(repository: string): Promise<string> {

let shaWithPrefix: string;
const ref = event?.ref || '';
if (ref !== '' && ref === `refs/heads/${default_branch}`) {
// on merge to default branch
const schedule = event?.schedule || '';
if (
(ref !== '' && ref === `refs/heads/${default_branch}`) ||
schedule !== ''
) {
// on merge to default branch or on scheduled workflow
shaWithPrefix = `${default_branch}-${sha}`;
} else {
// on pull request
Expand Down

0 comments on commit ba83ffb

Please sign in to comment.