From 9e78309fcea59b8e916d8eaefb24383461961e18 Mon Sep 17 00:00:00 2001 From: Steve Boyd Date: Tue, 31 May 2022 16:21:54 +1200 Subject: [PATCH] MNT Add auto-tag workflow --- .github/workflows/auto-tag.yml | 12 ++++++++++++ README.md | 15 +++++++++++++-- action.yml | 7 +++++++ 3 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/auto-tag.yml diff --git a/.github/workflows/auto-tag.yml b/.github/workflows/auto-tag.yml new file mode 100644 index 0000000..33446ca --- /dev/null +++ b/.github/workflows/auto-tag.yml @@ -0,0 +1,12 @@ +name: Auto-tag +on: + push: + tags: + - '*.*.*' +jobs: + auto-tag: + name: Auto-tag + runs-on: ubuntu-latest + steps: + - name: Auto-tag + uses: silverstripe/gha-auto-tag@main diff --git a/README.md b/README.md index 21b7f91..efacb2c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,16 @@ # GitHub Actions - Pull request -Create a new branch, makes a commit and a creates a pull-request using with a github-actions user as the author +Create a new branch, makes a commit and a creates a pull-request using with a github-actions user as the author. These will be created on the account/repo that called the actions. -This will be created on the account/repo that called the actions, it will not create a pull-request in a forked repo. +## Usage + +**workflow.yml** +```yml +steps: + - name: Create pull-request + uses: silverstripe/gha-pull-request@main + with: + branch: pulls/4/my-branch + title: NEW My pull-request title + description: This pull-request does great things +``` diff --git a/action.yml b/action.yml index 3a5b275..afde28f 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,7 @@ name: Branch commit and pull-request + description: GitHub Action to create a branch, commit and a pull-request as the github-actions user + inputs: branch: type: string @@ -11,9 +13,11 @@ inputs: type: string required: false default: '' + runs: using: composite steps: + - name: Validate branch shell: bash env: @@ -37,6 +41,9 @@ runs: TITLE: ${{ inputs.title }} DESCRIPTION: ${{ inputs.description }} run: | + # Escape double quotes '"' => '\"' + TITLE=${TITLE//\"/\\\"} + DESCRIPTION=${DESCRIPTION//\"/\\\"} BASE_BRANCH=$(git rev-parse --abbrev-ref HEAD) # Run git commit, push and create pull-request as 'github-actions' user git config --local user.name "github-actions"