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

Add custom GitHub action and pull request template to enforce that documentation is updated #1694

Merged
merged 5 commits into from
Jul 17, 2024

Conversation

dddlr
Copy link
Collaborator

@dddlr dddlr commented Jul 16, 2024

Added a pull request template with a checklist that asks that documentation be updated for every PR.

This is enforced by a custom GitHub action that checks whether any tasks in the checklist are marked as incomplete. If any are incomplete, the GitHub action will give an error.

You can exempt parts the PR description from the incomplete task check by adding <!-- task-checklist-ignore-start --> and <!-- task-checklist-ignore-end --> around the sections where you want to disable the check.


Test it out here!

  • Item in the checklist
  • Another item in the checklist
  • A third item in the checklist

Screenshot 2024-07-16 at 11 32 59

Screenshot 2024-07-16 at 11 34 14


Alternative methods considered for finding incomplete tasks in the PR description:

Copy link

changeset-bot bot commented Jul 16, 2024

⚠️ No Changeset found

Latest commit: ac49a30

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

netlify bot commented Jul 16, 2024

Deploy Preview for compiled-css-in-js canceled.

Name Link
🔨 Latest commit ac49a30
🔍 Latest deploy log https://app.netlify.com/sites/compiled-css-in-js/deploys/6695f494bb61e90009b7b093

@dddlr dddlr marked this pull request as ready for review July 16, 2024 01:30
Copy link
Collaborator

@kylorhall-atlassian kylorhall-atlassian left a comment

Choose a reason for hiding this comment

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

I didn't exactly validate the logic of the regex's and all that, but generally looks good to me! Some minor, very minor suggestions to freely ignore around logging mostly.

steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: cd .github/actions/task-checklist && yarn install
Copy link
Collaborator

Choose a reason for hiding this comment

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

I feel like you can just put this into .github/actions/task-checklist/action.yml, but … it's been 2 years since I build Github Actions a lot and I don't have any examples in repos I have access to nowadays; doesn't really matter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

had a quick look into this - doesn't look like javascript actions support calling shell commands out of the box

composite actions seems like a potential way to make this possible, will try it out

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah, that was it, composite actions…you do you though, no dramas here, it's clear what you're doing.

.github/workflows/task-checklist.yml Outdated Show resolved Hide resolved
on:
check_run:
pull_request:
types: [opened, edited]
Copy link
Collaborator

Choose a reason for hiding this comment

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

These types make sense to me! Good job here.

'False positive? Insert <!-- task-checklist-ignore-start --> and <!-- task-checklist-ignore-end --> in the section(s) of your PR where you want to skip the check.'
);
console.log('However, with great power comes great responsibility...');
console.log('---');
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think the suggestion is to use core.info instead of console.log and core.debug for anything you want hidden behind the debug flag.

I'd suggest changing console.log => core.info, but to be honest I can't tell you the difference.

}

console.log('---');
console.log(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could be a core.warning if you care at all.

const run = () => {
const body = github.context.payload.pull_request?.body;
if (!body) {
console.log('PR description empty, skipping this check.');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could be a core.warning or even core.notice (to annotate) if you care at all.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ah looks like the core functions https://github.com/actions/toolkit/tree/main/packages/core#annotations have better integrations with GitHub's UI, good idea

Copy link
Collaborator

@kylorhall-atlassian kylorhall-atlassian Jul 16, 2024

Choose a reason for hiding this comment

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

Yeah, I just don't exactly know what core.info does over console.log, but the rest is helpful!

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Screenshot 2024-07-16 at 14 19 57
Screenshot 2024-07-16 at 14 20 42

nifty

Copy link
Collaborator

Choose a reason for hiding this comment

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

Atlassian NPM mirror

@@ -0,0 +1 @@
registry="https://registry.yarnpkg.com"
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

ensure we don't accidentally use atlassian NPM mirror

Copy link
Collaborator

@kylorhall-atlassian kylorhall-atlassian left a comment

Choose a reason for hiding this comment

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

Just looking at changes since last review, I think you covered it (and the NPM issue), LGTM.

@dddlr dddlr merged commit c807221 into master Jul 17, 2024
14 of 16 checks passed
@dddlr dddlr deleted the chore/add-github-checklist branch July 17, 2024 01:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants