Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
cyinma committed Jul 28, 2022
1 parent f816153 commit 53cdc58
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/ci.yaml
Expand Up @@ -23,14 +23,18 @@ jobs:
cp test/buf.bash tmp/bin/buf
chmod +x tmp/bin/buf
echo "${PWD}/tmp/bin" >> "${GITHUB_PATH}"
- name: run action
if: github.ref == 'refs/heads/main'
- name: run on branch
if: github.ref_type == 'branch' && github.ref != 'refs/heads/main'
uses: ./
with:
buf_token: fake-buf-token
input: path/to/input
env:
WANT_BUF_TOKEN: fake-buf-token
WANT_ARGS: push path/to/input --draft ${{ github.ref_name }}
- name: run on main
if: github.ref_type == 'branch' && github.ref == 'refs/heads/main'
run: "echo $WANT_ARGS"
env:
WANT_BUF_TOKEN: fake-buf-token
WANT_ARGS: push path/to/input --tag ${{ github.sha }}
GITHUB_REF_TYPE: branch
GITHUB_REF_NAME: main
7 changes: 6 additions & 1 deletion push.bash
Expand Up @@ -41,8 +41,13 @@ if [ -z "$BUF_COMMAND" ]; then
fail "$NOT_INSTALLED_MESSAGE"
fi

if ["${GITHUB_REF_TYPE}" != "branch" ]; then
echo "reference type is not branch, skipping" >&2
exit 0
fi

BUF_ARGS=("--tag" "${GITHUB_SHA}")
if [ "${GITHUB_REF_TYPE}" = "branch" ] && [ "${GITHUB_REF_NAME}" != "main" ]; then
if [ "${GITHUB_REF}" != "refs/heads/main" ]; then
# Check that --draft is supported by running "buf push --draft example --help"
# and checking for "unknown flag: --draft" in the output.
set +e
Expand Down

0 comments on commit 53cdc58

Please sign in to comment.