Skip to content

Commit c6c9f5b

Browse files
revert delete action
1 parent 75a7eb7 commit c6c9f5b

File tree

4 files changed

+63
-1
lines changed

4 files changed

+63
-1
lines changed

.github/workflows/main.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
name: run codefresh pipeline
22
on: push
33
jobs:
4+
5+
clone:
6+
runs-on: ubuntu-18.04
7+
steps:
8+
- name: 'clone'
9+
- uses: actions/checkout@master
10+
env:
11+
PIPELINE_NAME: 'codefresh-pipeline'
12+
TRIGGER_NAME: 'codefresh-trigger'
13+
CF_API_KEY: ${{ secrets.GITHUB_TOKEN }}
14+
id: run-pipeline
15+
16+
417
build:
518
runs-on: ubuntu-18.04
619
steps:
720
- name: 'run pipeline'
8-
uses: codefresh-io/codefresh-pip-runner-action@master
21+
uses: ./codefresh-action
922
env:
1023
PIPELINE_NAME: 'codefresh-pipeline'
1124
TRIGGER_NAME: 'codefresh-trigger'

codefresh-action/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"]

codefresh-action/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'

codefresh-action/runner-entrypoint.sh

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)