Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/trigger-gitlab-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ on:
required: false
default: true
type: boolean
github-sha-override:
description: "Option to override the SHA"
required: false
type: string
default: ""
secrets:
ci-api-v4-url:
description: 'GitLab API v4 root URL'
Expand Down Expand Up @@ -72,6 +77,4 @@ jobs:
ACCESS_TOKEN: ${{ secrets.access-token }}
TRIGGER_TOKEN: ${{ secrets.trigger-token }}
PROJECT_ID: ${{ secrets.project-id }}



GITHUB_SHA_OVERRIDE: ${{ inputs.github-sha-override }}
11 changes: 10 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ function getEnv (name) {
return val;
}

function getOptionalEnv (name) {
return process.env[name] || '';
}

function getBooleanEnv (name) {
const trueValue = ['true', 'True', 'TRUE'];
const falseValue = ['false', 'False', 'FALSE'];
Expand All @@ -140,7 +144,8 @@ async function main () {
projectId: getEnv('PROJECT_ID'),
triggeredRef: getEnv('TRIGGERED_REF'),
schedule: getBooleanEnv('SCHEDULE'),
cancelOutdatedPipelines: getBooleanEnv('CANCEL_OUTDATED_PIPELINES')
cancelOutdatedPipelines: getBooleanEnv('CANCEL_OUTDATED_PIPELINES'),
githubShaOverride: getOptionalEnv('GITHUB_SHA_OVERRIDE')
};

const githubConfig = {
Expand All @@ -157,6 +162,10 @@ async function main () {
break;
case 'push':
case 'schedule':
if (inputConfig.githubShaOverride) {
githubConfig.githubSha = inputConfig.githubShaOverride;
}
break;
case 'merge_group':
break;
default:
Expand Down