Skip to content

Commit 83697a4

Browse files
change uses
1 parent 48c7820 commit 83697a4

File tree

4 files changed

+50
-1
lines changed

4 files changed

+50
-1
lines changed

.github/workflows/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM codefresh/cli
2+
3+
LABEL "com.github.actions.name"="codefresh-pipeline-runner"
4+
LABEL "com.github.actions.description"="allows to run custom codefresh pipelines"
5+
LABEL "com.github.actions.icon"="play-circle"
6+
LABEL "com.github.actions.color"="green"
7+
8+
LABEL "repository"="https://github.com/codefresh-io/codefresh-pipeline-runner"
9+
LABEL "homepage"="https://github.com/codefresh-io/codefresh-pipeline-runner"
10+
LABEL "maintainer"="<denys@codefresh.io>"
11+
12+
ADD runner-entrypoint.sh /runner-entrypoint.sh
13+
14+
ENTRYPOINT ["/runner-entrypoint.sh"]

.github/workflows/action.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
name: 'Codefresh pipeline runner'
2+
description: 'Github action that runs codefresh pipeline'
3+
author: 'codefresh'
4+
branding:
5+
icon: 'arrow-right-circle'
6+
color: 'green'
7+
runs:
8+
using: 'docker'
9+
image: 'Dockerfile'

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ jobs:
55
runs-on: ubuntu-18.04
66
steps:
77
- name: 'run pipeline'
8-
uses: action.yml
8+
uses: .github/workflows
99
with:
1010
PIPELINE_NAME: 'codefresh-pipeline'
1111
TRIGGER_NAME: 'codefresh-trigger'
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh
2+
3+
# parse branch
4+
if [ -f $GITHUB_EVENT_PATH ]; then
5+
# in case of push event
6+
BRANCH=$(cat $GITHUB_EVENT_PATH | jq -r .ref | awk -F '/' '{print $3}')
7+
8+
if [ -z "$BRANCH" ]
9+
then
10+
# in case of pullresuest event
11+
BRANCH=$(cat $GITHUB_EVENT_PATH | jq -r head.ref)
12+
fi
13+
else
14+
echo "Required file on path 'GITHUB_EVENT_PATH' not exists"
15+
fi
16+
17+
codefresh auth create-context context --api-key $CF_API_KEY
18+
codefresh auth use-contex context
19+
20+
21+
if [ -n "$TRIGGER_NAME" ]
22+
then
23+
codefresh run $PIPELINE_NAME --trigger=$TRIGGER_NAME --branch=$BRANCH
24+
else
25+
codefresh run $PIPELINE_NAME --branch=$BRANCH
26+
fi

0 commit comments

Comments
 (0)