Skip to content

Commit

Permalink
Merge pull request #35 from promiseofcake/ljk/update-docs
Browse files Browse the repository at this point in the history
Update Documentation
  • Loading branch information
Lucas Kacher authored Nov 13, 2020
2 parents 2d1bdfa + 1ff3315 commit 1c74fe3
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: "units-test"
on:
pull_request:
push:
branches:
- main
- 'releases/*'

jobs:
# test action works running from the graph
Expand All @@ -18,5 +14,5 @@ jobs:
with:
project-slug: ${{ github.repository }}
user-token: ${{ secrets.CIRCLECI_TOKEN }}
branch: ${{ github.ref }}
branch: ${{ github.head_ref }} # in pull request context we can just use this
payload: '{"run_output_workflow": true, "output_value": "${{ env.OUTPUT_VALUE }}"}'
23 changes: 23 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: "units-test"
on:
push:
branches:
- main
- 'releases/*'

jobs:
# test action works running from the graph
test:
runs-on: ubuntu-latest
env:
OUTPUT_VALUE: overloaded output value
steps:
- uses: actions/checkout@v2
- name: Capture triggering branch name
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- uses: ./
with:
project-slug: ${{ github.repository }}
user-token: ${{ secrets.CIRCLECI_TOKEN }}
branch: ${{ env.BRANCH_NAME }}
payload: '{"run_output_workflow": true, "output_value": "${{ env.OUTPUT_VALUE }}"}'
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ One may ask, why would I use CircleCi if I am also using Github Actions? This
action does not aim to answer that question, but if you happen to be working in
that paradigm, hopefuly it will be of use to you.

The main use case is:

* I have enabled "Only build Pull Requests" in CircleCI
* I want to trigger builds on pushes to non-main/master branches

### Caveat

Since CircleCi alraedy allows individuals to trigger builds on pushes in a pull request context, this action isn't strictly designed for that. If for some reason you want to do that, you will need to do the parsing and groking of the branch name yourself from the [Github Context](https://docs.github.com/en/free-pro-team@latest/actions/reference/context-and-expression-syntax-for-github-actions#github-context) as opposed to following the example below.

## Usage

Requirements:
Expand All @@ -28,12 +37,14 @@ jobs:
execute:
runs-on: ubuntu-latest
steps:
- name: Capture triggering branch name
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: Trigger CircleCI build-beta workflow.
uses: promiseofcake/circleci-trigger-action@v1
with:
user-token: ${{ secrets.CIRCLECI_TOKEN }}
project-slug: promiseofcake/circleci-trigger-action
branch: ${GITHUB_REF#refs/heads/}
branch: ${{ env.BRANCH_NAME }}
payload: '{"run_output_workflow": true}'
```
Expand Down

0 comments on commit 1c74fe3

Please sign in to comment.