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

feat: add a feedback comment on a validation error #395

Merged
merged 3 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions .github/actions/validate-format/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: 'Validate Format'
runs:
using: 'composite'
steps:
- run: /bin/bash "${{ github.action_path }}/validate_format.sh" "${{ github.workspace }}/program-list.json"
shell: bash
8 changes: 8 additions & 0 deletions .github/actions/validate-format/validate_format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
PROGRAM_LIST_JSON="$1"

jq --indent 3 -s '.[] | unique_by(.program_name)' < "$PROGRAM_LIST_JSON" > "_"

if ! cmp -s "$PROGRAM_LIST_JSON" "_"; then
echo '::error title=Bad format::The "program-list.json" file is not formatted and sorted in accordance with the guidelines. Please use the command from https://github.com/disclose/diodb#how-to-contribute to format and sort the file.'
exit 1
fi
24 changes: 24 additions & 0 deletions .github/workflows/feedback.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: feedback

on:
workflow_run:
workflows: [validate-program-list]
types: [completed]

permissions:
pull-requests: write

jobs:
feedback:
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'failure'
steps:
- uses: peter-evans/create-or-update-comment@c9fcb64660bc90ec1cc535646af190c992007c32 # v2.0.0
with:
issue-number: ${{ github.event.workflow_run.pull_requests[0].number }}
body: |
Some of the automated checkes have failed. Passing the checks is required to merge the pull request.

Please see annotations at https://github.com/${{ github.repository }}/actions/runs/${{ github.event.workflow_run.id }} for the details and steps to remediate the issue(s).

cc @${{ github.event.workflow_run.actor.login }}
8 changes: 1 addition & 7 deletions .github/workflows/validate-program-list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Verify formatting
run: |
jq --indent 3 -s '.[] | unique_by(.program_name)' < program-list.json > _
if ! diff program-list.json _; then
echo 'Please format `program-list.json` with https://github.com/disclose/diodb#how-to-contribute.'
exit 1
fi
- uses: ./.github/actions/validate-format