Open sparksp opened 4 years ago
This has been successfully achieved using another workflow. I recommend not including this in pull_request
workflows because a PR from a fork has no write access to the original project, whereas the push
fixes will get applied to the fork directly instead. Given that this can already be solved with existing actions I won't be adding this to the action, but would like to write up a recipe book including this at some point.
name: Fixes
on:
push:
branches: ['**']
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Get yarn cache directory
id: yarn-cache-dir
run: echo "::set-output name=path::$(yarn cache dir)"
- uses: actions/cache@v1
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir.outputs.path }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- uses: actions/cache@v1
id: elm-cache
with:
path: ~/.elm
key: ${{ runner.os }}-elm--home-${{ hashFiles('**/elm.json') }}
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Add yarn bin to path
run: echo ::add-path::$(yarn bin)
- name: Run elm-format
run: elm-format --yes
- name: Apply elm-review fixes
id: elm-review
run: yes | elm-review --fix-all
continue-on-error: true
- uses: peter-evans/create-pull-request@v2
with:
commit-message: 'Apply elm-review fixes'
branch: fixes/${{ steps.extract_branch.outputs.branch }}
title: "Apply elm-review fixes"
body: "*This is an automated pull request because elm-review found problems that could be fixed automatically.*"
reviewers: sparksp
assignees: sparksp
If elm-review offers any fixes then we could try to apply them and provide them as a new pull request against the working changes.