GithubHelp home page GithubHelp logo

marocchino / checkbox-action Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 1.0 1.3 MB

Checks or unchecks a checkbox in the body of the pull request, or returns the list confirming the change in the checkbox.

License: MIT License

TypeScript 98.70% JavaScript 1.30%
checkbox github-actions pull-requests

checkbox-action's Issues

doesn't report checkboxes that are always checked

If a Pr is built from a template, and that template starts any checkbox off as checked, then this action will only return those checkbox items if they are changed.

this action should probably change the output from

outputs = { checked, unchecked }

to

outputs = {
  changed: { checked, unchecked },
  checked, unchecked
}

so that it properly communicates the intent of the `getDiff` outputs.

Fails when the title is changed

Hello,

It looks like this action doesn't handle the case when only the pull request title is changed.

With this trigger the action can be run when the title or the description is changed:

on: 
  pull_request:
    types: [edited]

But when only the title is concerned it seems that the github.context.payload.changes.body variable (used here) is empty or absent (cf. docs).

Leading to this error:

Run marocchino/checkbox-action@03a47510e9dcd6931775838d362ec698bac07c16
  with:
    action: detect
    error: error
    GITHUB_TOKEN: ***
Error: Cannot read properties of undefined (reading 'from')

fails when pull_request is undefined

For some two functions attempting to get body are failing because github.context.payload.pull_request is undefined.

When the PR body hasn't changed from its original state, this function fails because changes.body.from doesn't exist on the context until changes are made to the PR body.

https://github.com/marocchino/checkbox-action/blob/main/src/detect.ts#L7

image

workflow:

name: Check PR title

on:
  pull_request_target:
    types:
      - opened
      - reopened
      - edited
      - synchronize

jobs:
  DetectCheckboxes:
    runs-on: ubuntu-latest
    outputs:
      checked: ${{ steps.detect.outputs.checked }}
    steps:
      - uses: marocchino/checkbox-action@v1
        id: detect
        with:
          action: 'detect'

  PrintCheckboxes:
    needs: DetectCheckboxes
    runs-on: ubuntu-latest
    steps:
      - run: |
          echo ${{needs.detect.outputs.checked}}

  LintPrTitle:
    runs-on: ubuntu-latest
    permissions:
      statuses: write
    steps:
      - uses: aslafy-z/conventional-pr-title-action@v3
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

The PR template :

# Description

## What kind of change is this?

- [ ] bug fix
- [ ] documentation
- [ ] new feature

## Steps to test changes

<!-- 
It's important that changes proposed are able to be verified by others.
Provide enough information for others to follow. Screenshots are welcome.
//-->

1. Build the app with `command to build`
2. Run the app with `./build/lamp --required-args`
3. Configure the app ...
4. Do this in the app ...
5. Then this ...
6. Observe this in the app ... to confirm changes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.