Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vale GHA improvements #4304

Merged
merged 4 commits into from
May 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 24 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,35 @@ jobs:
- name: Get Changed Files
id: get_changed_files
uses: jitterbit/get-changed-files@v1
# The continue-on-error parameter is set to true as a
# workaround for the `head commit is not ahead of base
# commit` error that can appear when the PR branch is
# out of date.
continue-on-error: true
Copy link
Contributor Author

@nmelehan nmelehan May 7, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how c551efc was tested out:

  1. I made a new branch off of main with a new test markdown file. The file doesn't matter; what matters is that the branch was made off of main. I then made a pull request that targeted develop (not main) for this branch:

    • test vale stuff #4306
    • Our Vale GitHub action failed on this with the head commit error because main, which was used to start the new branch, is currently behind develop
  2. I made another new branch off of main with the proposed continue-on-error: true fix. Then I made a pull request that targeted develop (not main) for this branch:

with:
format: 'json'
- name: Install more-utils
run: sudo apt-get install moreutils
- name: Select Files in Docs Dir
# This action filters the list of added and modified
# files to only the files that are in the docs/ directory
id: select_docs_dir_files
run: |
docs_dir_files=$(echo $added_modified | jq -c '[.[] | select(.|test("^docs/"))]')
echo "::set-output name=added_modified::$docs_dir_files"
echo "Added or modified files located within docs/ directory:"
echo $docs_dir_files | jq '.'
env:
added_modified: ${{ steps.get_changed_files.outputs.added_modified }}
- name: Vale
uses: errata-ai/[email protected]
# Only run the Vale step if the list of added and modified
# files inside the docs directory is not empty. If we don't
# add this conditional, the Vale step hangs and never
# completes when it is passed the empty array.
if: ${{ '[]' != steps.select_docs_dir_files.outputs.added_modified }}
with:
files: '${{ steps.get_changed_files.outputs.added_modified }}'
files: '${{ steps.select_docs_dir_files.outputs.added_modified }}'
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

Expand Down