Skip to content

Commit c5deda1

Browse files
committed
Moved changes to context module, added check to prevent overriding user input
Signed-off-by: Jyotsna <[email protected]>
1 parent 5d06edc commit c5deda1

File tree

3 files changed

+11
-15
lines changed

3 files changed

+11
-15
lines changed

dist/index.js

Lines changed: 10 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/context.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ export function tmpNameSync(options?: tmp.TmpNameOptions): string {
5454
}
5555

5656
export async function getInputs(defaultContext: string): Promise<Inputs> {
57-
5857
let userInputs = {
5958
context: core.getInput('context') || defaultContext,
6059
file: core.getInput('file') || 'Dockerfile',
@@ -79,7 +78,7 @@ export async function getInputs(defaultContext: string): Promise<Inputs> {
7978

8079
//Add repo as source-label if not already supplied by user
8180
const sourceLabelKey = 'org.opencontainers.image.source';
82-
if( userInputs.labels.find(val => val.startsWith(sourceLabelKey) == true ) == null){
81+
if (userInputs.labels.find(val => val.startsWith(sourceLabelKey) == true) == null) {
8382
userInputs.labels.push(
8483
`${sourceLabelKey}=https://github.com/${github.context.repo.owner}/${github.context.repo.repo}`
8584
);

src/main.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,6 @@ async function run(): Promise<void> {
2424
const defContext = context.defaultContext();
2525
let inputs: context.Inputs = await context.getInputs(defContext);
2626

27-
//Add dockerfile path to label
28-
let dockerfilePath = core.getInput('file') || 'Dockerfile';
29-
inputs.labels.push(
30-
`org.opencontainers.image.source=https://github.com/${github.context.repo.owner}/${github.context.repo.repo}`
31-
);
32-
inputs.labels.push(`dockerfile-path=${dockerfilePath}`);
33-
3427
core.info(`🏃 Starting build...`);
3528
const args: string[] = await context.getArgs(inputs, defContext, buildxVersion);
3629
await exec.exec('docker', args).then(res => {

0 commit comments

Comments
 (0)