Codefresh Steps: Reusable Code for Common Operations
This page provides code you can use to perform common operations in the Codefresh CI/CD platform.
Open or update a GitHub PR github-pr
Create, edit, or annotate a GitHub pull request.
arguments
create-github-pr:
type: github-pr
arguments:
GITHUB_TOKEN: '${{GITHUB_TOKEN}}'
GITHUB_REPO_OWNER: '${{GITHUB_REPO_OWNER}}'
GITHUB_REPO_NAME: '${{GITHUB_REPO_NAME}}'
HEAD: '${{CF_BRANCH}}'
TITLE: 'Codefresh PR for ${{CF_BRANCH}}'
BASE: master
merge_github_pr:
type: github-pr
arguments:
GITHUB_TOKEN: '${{GITHUB_TOKEN}}'
GITHUB_REPO_OWNER: '${{CF_REPO_OWNER}}'
GITHUB_REPO_NAME: '${{CF_REPO_NAME}}'
GITHUB_PR_NUMBER: '${{CF_PULL_REQUEST_NUMBER}}'
GITHUB_PR_OPERATION: merge
delete_merged_branch:
image: 'alpine/git:latest'
commands:
- 'rm -rf ${{CF_REPO_NAME}}'
- >-
git clone
https://codefresh:${{GITHUB_TOKEN}}@github.com/${{CF_REPO_OWNER}}/${{CF_REPO_NAME}}.git
- 'cd ${{CF_REPO_NAME}}'
- 'git push origin --delete ${{CF_BRANCH}}'