Skip to content

Commit

Permalink
Update to use new actions-utils that is aware of ALL_CHANGED_FILES (#28)
Browse files Browse the repository at this point in the history
## Summary:
See Khan/actions-utils#14

## Test plan:
I updated the workflow to set up the ALL_CHANGED_FILES variable. Our other workflows that use eslint-action will want to add those setup steps as well.

Author: jaredly

Reviewers: jeresig, jaredly

Required Reviewers: 

Approved by: jeresig

Checks: ❌ lint_and_unit, ✅ autofix

Pull request URL: #28
  • Loading branch information
jaredly committed Aug 4, 2021
1 parent b8c7b9e commit 299f687
Show file tree
Hide file tree
Showing 7 changed files with 198 additions and 140 deletions.
21 changes: 19 additions & 2 deletions .github/workflow-templates/_setup.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@

setup:
checkout:
- uses: actions/checkout@v1
name: get the repo
- uses: actions/checkout@v2
yarn:
setup: checkout
steps:
- run: yarn

# This gets the list of files that changed in the current pull-request
# and puts then onto the ALL_CHANGED_FILES env variable, which several
# of our actions will use.
changed-files:
steps:
- name: Get All Changed Files
uses: jaredly/[email protected]
id: changed
with:
format: 'json' # robust to filenames with spaces
absolute: true # our tooling expects absolute paths

# Now we put it on the environment so that it can be picked up by
# anything that uses actions-utils (e.g. eslint-action, jest-action, etc.)
- uses: allenevans/[email protected]
with:
ALL_CHANGED_FILES: '${{ steps.changed.outputs.added_modified }}'
10 changes: 5 additions & 5 deletions .github/workflow-templates/pr-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ jobs:
steps:
- name: Run eslint
uses: Khan/eslint-action@main
setup: yarn
setup: [yarn, changed-files]
with:
eslint-lib: ./node_modules/eslint
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run jest tests
uses: Khan/jest-action@main
setup: yarn
setup: [yarn, changed-files]
with:
jest-bin: ./node_modules/.bin/jest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run jest coverage
uses: Khan/jest-coverage-action@main
setup: yarn
setup: [yarn, changed-files]
with:
jest-bin: ./node_modules/.bin/jest
coverage-data-path: ./coverage/coverage-final.json
Expand All @@ -36,15 +36,15 @@ jobs:

- name: Run flow
uses: Khan/flow-action@main
setup: yarn
setup: [yarn, changed-files]
with:
flow-bin: ./node_modules/.bin/flow
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run flow coverage
uses: Khan/flow-coverage-action@main
setup: yarn
setup: [yarn, changed-files]
with:
flow-bin: ./node_modules/.bin/flow
env:
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/pr-actions.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions .github/workflows/pr-autofix.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 299f687

Please sign in to comment.