-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
179 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM composer:latest | ||
|
||
RUN composer global require devanox/laravel-revive ^1.0 --no-progress --dev | ||
ENV PATH="/tmp/vendor/bin:${PATH}" | ||
|
||
COPY "entrypoint.sh" "/entrypoint.sh" | ||
RUN chmod +x /entrypoint.sh | ||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,157 @@ | ||
# GitHub Action for Devanox Laravel Revive | ||
|
||
We are working on it | ||
GitHub Action for the [Devanox Laravel Revive](https://github.com/devanoxLtd/revive) package. | ||
|
||
If your project requires PHP 8.0 use `devanoxLtd/revive-action@v1` which pulls in Laravel Revive `1.x`. | ||
|
||
## Usage | ||
|
||
Use with [GitHub Actions](https://github.com/features/actions) | ||
|
||
```yml | ||
# .github/workflows/revive.yml | ||
name: Revive | ||
|
||
on: | ||
push: | ||
branches: main | ||
pull_request: | ||
|
||
jobs: | ||
revive: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: "revive" | ||
uses: devanoxLtd/revive-action@v2 | ||
with: | ||
args: lint | ||
``` | ||
--- | ||
To use additional Laravel Revive options use `args`: | ||
|
||
```yml | ||
# .github/workflows/revive.yml | ||
name: Revive | ||
on: | ||
push: | ||
branches: main | ||
pull_request: | ||
jobs: | ||
revive: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: "revive" | ||
uses: devanoxLtd/revive-action@v2 | ||
with: | ||
args: lint --using=tlint,pint | ||
``` | ||
|
||
--- | ||
|
||
If you would like to automatically commit any required fixes you can add the [Git Auto Commit Action](https://github.com/marketplace/actions/git-auto-commit) by [Stefan Zweifel](https://github.com/stefanzweifel). | ||
|
||
```yml | ||
# .github/workflows/revive.yml | ||
name: Revive Fix | ||
on: | ||
push: | ||
branches: main | ||
pull_request: | ||
jobs: | ||
revive: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
- name: "revive" | ||
uses: devanoxLtd/revive-action@v2 | ||
with: | ||
args: fix | ||
- uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Revive Fix | ||
commit_user_name: GitHub Action | ||
commit_user_email: [email protected] | ||
``` | ||
|
||
>**Note** The resulting commit **will not trigger** another GitHub Actions Workflow run. | ||
>This is due to [limitations set by GitHub](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow). | ||
|
||
To get around this you can indicate a workflow should run after "Revive Fix" using the `workflow_run` option. | ||
|
||
```yml | ||
on: | ||
workflow_run: | ||
workflows: ["Revive Fix"] | ||
types: | ||
- completed | ||
``` | ||
|
||
The name "Revive Fix" must match the name defined in your Revive workflow and [must be on the default branch](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run). | ||
|
||
Be sure to check out the [action's documentation](https://github.com/marketplace/actions/git-auto-commit) for limitations and options. | ||
|
||
--- | ||
|
||
To automatically ignore these commits from GitHub's git blame you can add the commit's hash to a `.git-blame-ignore-revs` file. | ||
|
||
```yml | ||
# .github/workflows/revive.yml | ||
name: Revive Fix | ||
on: | ||
push: | ||
branches: main | ||
pull_request: | ||
jobs: | ||
revive: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.head_ref }} | ||
- name: "Revive Fix" | ||
uses: devanoxLtd/revive-action@v2 | ||
with: | ||
args: fix | ||
- uses: stefanzweifel/git-auto-commit-action@v4 | ||
id: auto_commit_action | ||
with: | ||
commit_message: Revive Fix | ||
commit_user_name: GitHub Action | ||
commit_user_email: [email protected] | ||
- name: Ignore Revive Fix commit in git blame | ||
if: steps.auto_commit_action.outputs.changes_detected == 'true' | ||
run: echo ${{ steps.auto_commit_action.outputs.commit_hash }} >> .git-blame-ignore-revs | ||
- uses: stefanzweifel/git-auto-commit-action@v4 | ||
with: | ||
commit_message: Ignore Revive Fix commit in git blame | ||
commit_user_name: GitHub Action | ||
commit_user_email: [email protected] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: Devanox Laravel Revive | ||
description: Automatically apply Devanox's default code style for Laravel apps. | ||
branding: | ||
icon: 'plus' | ||
color: 'yellow' | ||
runs: | ||
using: docker | ||
image: Dockerfile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
echo "Running: revive" $* | ||
|
||
revive --version | ||
revive $* |