Skip to content

Commit

Permalink
Initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
spaceo committed Jul 17, 2021
1 parent 6fe92f9 commit a0f5699
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# .github/workflows/release.yml
name: Release

on:
pull_request:
types: closed

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Tag
uses: K-Phoen/semver-release-action@master
with:
release_branch: main
tag_format: "%major%.%minor%.%patch%"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28 changes: 28 additions & 0 deletions .github/workflows/update-reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: update-reviewdog
on:
schedule:
- cron: '14 14 * * *'

jobs:
reviewdog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: reviewdog/action-depup@master
id: update-reviewdog
with:
file: action.yml
version_name: REVIEWDOG_VERSION
repo: reviewdog/reviewdog

- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "Update ${{ steps.update-reviewdog.outputs.repo }} to ${{ steps.update-reviewdog.outputs.latest }}"
commit-message: "Update ${{ steps.update-reviewdog.outputs.repo }} to ${{ steps.update-reviewdog.outputs.latest }}"
body: |
Update ${{ steps.update-reviewdog.outputs.repo }} to [${{ steps.update-reviewdog.outputs.latest }}](https://github.com/${{ steps.update-reviewdog.outputs.repo }}/releases/tag/v${{ steps.update-reviewdog.outputs.latest }})
This PR is auto generated by [update-reviewdog workflow](https://github.com/${{ github.repository }}/actions?query=workflow%3A${{ github.workflow }}).
branch: update-reviewdog
base: main
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,18 @@
# action-phpcs
A GitHub action that runs a phpcs and reports the result to reviewdog

# Prerequisites
* Composer install has been executed
* Phpcs is install by composer and available in the composer config bin-dir
* The code styles used by phpcs are installed and confgured in .phpcs.xml

# Usage
Add a workflow step with the action:

```yaml
steps:
- name: Run phpcs
uses: reload/poc-phpcs-reviewdog-action@<VERSION>
with:
reviewdog_token: ${{ secrets.GITHUB_TOKEN }}`
```
28 changes: 28 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'Phpcs and reviewdog runner'
description: 'This action installs reviewdog 🐶, runs phpcs 🐘 and pipes output to reviewdog. It depends '
inputs:
reviewdog_token:
description: 'The Github API token needed for Reviewdog'
runs:
using: 'composite'
steps:
- name: Install phpcs
run: $GITHUB_ACTION_PATH/install.sh
shell: bash
env:
REVIEWDOG_VERSION: 0.10.2
REVIEWDOG_TEMPDIR: ${{ runner.temp }}
- name: Run phpcs and report to reviewdog
run: |
set +o pipefail
phpcs --config-set ignore_errors_on_exit 1
phpcs --config-set ignore_warnings_on_exit 1
$(composer config bin-dir)/phpcs --report=checkstyle \
| reviewdog -f=checkstyle -name=phpcs -reporter=github-pr-check -fail-on-error=true
shell: bash
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ inputs.reviewdog_token }}

branding:
icon: 'terminal'
color: 'gray-dark'
26 changes: 26 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

VERSION="${REVIEWDOG_VERSION:-latest}"

TEMP="${REVIEWDOG_TEMPDIR}"
if [ -z "${TEMP}" ]; then
if [ -n "${RUNNER_TEMP}" ]; then
TEMP="${RUNNER_TEMP}"
else
TEMP="$(mktemp -d)"
fi
fi

INSTALL_SCRIPT='https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh'
if [ "${VERSION}" == 'nightly' ] ; then
INSTALL_SCRIPT='https://raw.githubusercontent.com/reviewdog/nightly/master/install.sh'
VERSION='latest'
fi

mkdir -p "${TEMP}/reviewdog/bin"

echo '::group::🐶 Installing reviewdog ... https://github.com/reviewdog/reviewdog'
curl -sfL "${INSTALL_SCRIPT}" | sh -s -- -b "${TEMP}/reviewdog/bin" "${VERSION}" 2>&1
echo '::endgroup::'

echo "${TEMP}/reviewdog/bin" >>"${GITHUB_PATH}"

0 comments on commit a0f5699

Please sign in to comment.