GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |
GeezerVison is showing github.com — git: alternative github context and additional methods by crazy-max · Pull Request #55 · docker/actions-toolkit Conversation
Member
follow-up docker/metadata-action#248 Adds alternative context to the GitHub one for Git. @neilime PTAL. I keep you posted when we cut a new release of the actions-toolkit so you can rebase your PR on the metadata-action repo. You could then have smth like: --- src/context.ts | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/context.ts b/src/context.ts index 3738b23..dd819c9 100644 --- a/src/context.ts +++ b/src/context.ts @@ -1,7 +1,11 @@ import * as core from '@actions/core'; +import {Context} from '@actions/github/lib/context'; +import {Git} from '@docker/actions-toolkit/lib/git'; +import {GitHub} from '@docker/actions-toolkit/lib/github'; import {Util} from '@docker/actions-toolkit/lib/util'; export interface Inputs { + context: Context; images: string[]; tags: string[]; flavor: string[]; @@ -12,8 +16,9 @@ export interface Inputs { githubToken: string; } -export function getInputs(): Inputs { +export async function getInputs(): Promise<Inputs> { return { + context: await getContextInput('context'), images: Util.getInputList('images', {ignoreComma: true}), tags: Util.getInputList('tags', {ignoreComma: true}), flavor: Util.getInputList('flavor', {ignoreComma: true}), @@ -24,3 +29,20 @@ export function getInputs(): Inputs { githubToken: core.getInput('github-token') }; } + +export enum ContextSource { + workflow = 'workflow', + git = 'git' +} + +async function getContextInput(name: string): Promise<Context> { + const input = core.getInput(name); + switch (input) { + case ContextSource.workflow: + return GitHub.context; + case ContextSource.git: + return await Git.context(); + default: + throw new Error(`Invalid context: ${input}`); + } +}
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
crazy-max
force-pushed
the
git-context
branch
2 times, most recently
from
442a46c to
b8325fe
Compare
crazy-max
marked this pull request as ready for review
Signed-off-by: CrazyMax <[email protected]>
crazy-max
force-pushed
the
git-context
branch
from
b8325fe to
8a69d6c
Compare
|
There was an error while loading. Please reload this page.
|
@crazy-max I've done the job on docker/metadata-action#248, waiting for you review |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.