Skip to content

feat(pr-title): Add empty commit step - #167

Closed
chris3ware wants to merge 7 commits into
mainfrom
feat-pr-title-empty-commit
Closed

feat(pr-title): Add empty commit step#167
chris3ware wants to merge 7 commits into
mainfrom
feat-pr-title-empty-commit

Conversation

@chris3ware

@chris3warechris3ware commented Mar 5, 2025

Copy link
Copy Markdown
Member

The required check (enforce-all-checks) will fail if the PR title is invalid - as expected.

enforce-all-checks polls the check api for the most recent commit in the PR. Fixing the PR title does not generate a new commit which means re-running the failed checks workflow still results in failing - because it is polling the previous commit.

In this PR a step will be added to push an empty commit to trigger the checks workflow on a new commit where the PR title check has succeeded.

edit to trigger context output debug

if: always() is required to run steps that deal with failures. For
example, when the PR title is invalid, the step fails but the PR
comment should be created and the failure summary should be added.
Delete Comment and valid title summary will always run anyway because
the preceding steps have succeeded.
@chris3ware
chris3ware requested a review from a team as a code ownerMarch 5, 2025 13:06
This workflow does not need to run when a PR is edited because this
event does not generate a new commit.
@chris3warechris3ware changed the title feat(pr-title): Add empty commit stepfeat(pr-title): add empty commit stepMar 5, 2025
@chris3warechris3ware changed the title feat(pr-title): add empty commit stepfeat(pr-title): Add empty commit stepMar 5, 2025
@chris3warechris3ware changed the title feat(pr-title): Add empty commit stepfeat(pr-title): Add empty commit step changeMar 5, 2025
@chris3warechris3ware changed the title feat(pr-title): Add empty commit step changefeat(pr-title): Add empty commit step change to trigger checksMar 5, 2025
@chris3warechris3ware changed the title feat(pr-title): Add empty commit step change to trigger checksfeat(pr-title): Add empty commit step to trigger checksMar 5, 2025
The trigger step isn't working. So we need to see what is in the action
and changes context. Copilot think this needs running on
pull_request_target events to have access to the correct contexts.
@chris3warechris3ware changed the title feat(pr-title): Add empty commit step to trigger checksfeat(pr-title): Add empty commit stepMar 5, 2025
@chris3ware

Copy link
Copy Markdown
MemberAuthor

The step to push the empty commit is not running because access to the required contexts is not available with the pull_request event; pull_request_target should be used. (According to copilot). I have verified that the context output is empty with the following:

- name: dump pull request event details
run: |
echo "PR action: ${{ github.event.pull_request.action }}"
echo "PR changes: ${{ toJSON(github.event.pull_request.changes) }}"
# Trigger checks with empty commit when PR title is edited to resolve validation failure
- name: Trigger checks with empty commit
if: ${{ github.event.pull_request.action == 'edited' && github.event.pull_request.changes.title.from != null }}
run: |
echo "Title changed from: ${{ github.event.pull_request.changes.title.from }}"

Produces:

Run echo "PR action: "
echo "PR action: "
echo "PR changes: null"

@chris3ware
chris3ware deleted the feat-pr-title-empty-commit branch March 5, 2025 15:42
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

@chris3ware