Replies: 8 comments 1 reply
-
In the first place I'd suggest to create a dedicated test action instead. For me it looks you mix up various jobs here which I really would not suggest to do. Have a look at my workflows here, there is a clear separation of CI and pull request handling https://github.com/GsTYPO3/core-patches/tree/main/.github/workflows PR related action: https://github.com/GsTYPO3/core-patches/actions/runs/1818090001 |
Beta Was this translation helpful? Give feedback.
-
The test I'm referring to is run in local dev environment and devs paste the result into their commit. We want to use this check to make sure that the most-recent commit has passed this test before approving the PR. |
Beta Was this translation helpful? Give feedback.
-
@bbchase You should try it by set See also https://github.com/GsActions/commit-message-checker#configuration. |
Beta Was this translation helpful? Give feedback.
-
I have tried that. In that case, all commits associated with a PR are checked and if any commit does not contain the test message for whatever reason, the check will fail. I really only care that the latest commit contains this message. Here's the contents of the yml file if it helps: name: 'Commit Message Check'
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
pull_request_target:
types:
- opened
- edited
- reopened
- synchronize
push:
branches:
- main
jobs:
check-commit-message:
name: Look for Test Suite message
runs-on: ubuntu-latest
steps:
- name: Check Commit Type
uses: gsactions/commit-message-checker@v1
with:
pattern: '^Successful Full Test Suite Run at \d\d\d\d+-\d\d-\d\d \d\d:\d\d:\d\d UTC$'
error: 'The commit message must include a successful full test suite run.'
excludeTitle: true
excludeDescription: true
checkAllCommitMessages: true
accessToken: ${{ secrets.GITHUB_TOKEN }} |
Beta Was this translation helpful? Give feedback.
-
The problem here is your pattern, which tests for the start. Try this one If this does still not work, enable debugging see https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging. Then you will see the message which is built and you can use tools like https://regexr.com/ afterwards to find a working pattern. And if you enforce pull request, it does not make much sense to run the action for the main branch btw. |
Beta Was this translation helpful? Give feedback.
-
My issue isn't with getting the check to run successfully, it evaluates correctly. I just want to be able to run it against only the latest commit message. |
Beta Was this translation helpful? Give feedback.
-
any update to this? @bbchase were you able to get this validation for latest commit ? I am also facing a similar problem |
Beta Was this translation helpful? Give feedback.
-
See also #68 |
Beta Was this translation helpful? Give feedback.
-
I would like to be able to check for a pattern only in the most-recent commit message. Our use case is checking for the result of a test that I want to make sure has passed before a PR can be merged. e.g., Does the commit message contain "Test Successful"?
Some commits in a PR may not contain a test result or may contain an invalid test result, but I only care that the test was run and succeeds as of the latest commit.
I don't want to put the test result in the PR description because a commit made while the PR is open could cause my test to fail, but the GHA check would still pass because of the old message in the PR description.
Beta Was this translation helpful? Give feedback.
All reactions