Giter VIP home page Giter VIP logo

canvas-kit-actions's People

Contributors

alanbsmith avatar mannycarrera4 avatar nicholasboll avatar rayredgoose avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

canvas-kit-actions's Issues

Bug: Release action runs a script from non existing file

Step is here

utils/update-changelog.js is existing in CK, so that's why we don't have any failure, but this step should be more dynamic

## We could have gone the route of a lerna changeset plugin, but we would lose access to
    ## usernames which add a nice human touch to release notes
    - name: Update Changelog
      shell: bash
      run: node utils/update-changelog.js
      env:
        CHANGESET_TITLE: ${{steps.changeset.outputs.title}}
        CHANGESET_BODY: |
          ${{steps.changeset.outputs.body}}

Proposal: Update the generate changelog action

  • Add filter to get specific commits based on structure

Now generate changelog action generates changelog based on all commits made from specific tag. For multipackage repo we need to have opportunity to filter all commits and generate changelog based on selected commits only for specific package.

w/o filter

- feat(web): Add web tokens
- feat(mobile): Add mobile tokens
- chore: Add PR review GH action

with filter for web:

- feat(web): Add web tokens

  • Have a way to set the default section title, now it's Components

Proposal: Update documentation for GH actions

๐Ÿš€ Feature Proposal

Update documentation for GH actions:

  • Create List of actions on the top of Readme
  • Possibly have separated file for each action (?)
  • Make action description clear:
    • have description and usage sections
    • have input/output tables with its description

Automerge messages do not include additional contributors

Some pull requests have additional contributors and currently they are not given recognition. To fix this, a few things need to change.

  • Update getMergeData to support multiple contributors from commits
    • Add commits to the GraphQL call
    • process commits to look for additional authors
    • Process additional authors, deduping by unique name and preferring login (Github username)
    • Add Co-authored-by: {name} <{email}> lines to the end of the commit message so GitHub attributes contributions
  • Update getReleaseNotes to process the Co-authored-by strings to add additonal contributors in the release summary message

Dependabot PRs result in an empty release

We ignore PR lint rules for dependabot PRs because they are autogenerated, but this causes empty releases because this causes empty merge messages.

For example, the release notes are empty: https://github.com/Workday/canvas-kit/releases/tag/v7.0.13

Here's the PR: Workday/canvas-kit#1492

The dependabot PRs lack the normally required "sections" (category and summary). The utility function that needs to be updated is the getSections found here:

export function getSections(input: string): Sections {
let activeSection: keyof Sections | '' = ''
const sections = input
.replace(/\r/g, '')
.split('\n')
.reduce((result, line) => {
const headingMatch = line.match(/^#+\s+(.+)/)
const badgeMatch = line.match(
/^!\[[a-z]+\]\(https:\/\/img.shields.io\/badge\/([a-z_]+)-([a-z_]+)-[a-z]+\)/i,
)
if (headingMatch) {
const heading = headingMatch[1].trim().toLowerCase()
if (isValidHeading(heading)) {
activeSection = heading
result[activeSection] = ''
} else {
// Deactivate active section until a new one is found
activeSection = ''
}
} else if (badgeMatch) {
const heading = badgeMatch[1].replace(/_/g, ' ').trim()
const value = badgeMatch[2].replace(/_/g, ' ').trim()
if (isValidHeading(heading)) {
result[heading] = value
// we're done with this heading, deactivate the section
activeSection = ''
}
} else {
// A horizontal rule will break out of a section
if (line.trim() === '---') {
activeSection = ''
}
if (activeSection) {
result[activeSection] += `\n${line}`
}
}
return result
}, {} as Sections)
// trim sections and remove comments
for (const [key, value] of Object.entries(sections)) {
sections[key as keyof Sections] = value
.replace(/<!--[\s\S]+?-->/gm, '') // replace comments non-greedily in multiline mode
.replace(/[\n]{2,}/g, '\n\n') // assume more than 2 newlines in a row are a mistake, perhaps from removing comments
.trim()
}
return sections
}

The tests for getSections are unit tests found here:

describe('getSections', () => {
it('should parse headings into sections', () => {
const input = stripIndent`
## Summary
My summary
## Release Category
Components
## Release Note
My release notes
### BREAKING CHANGES
Some breaking changes
`
const expected = {
summary: 'My summary',
'release category': 'Components',
'release note': 'My release notes',
'breaking changes': 'Some breaking changes',
}
expect(getSections(input)).toEqual(expected)
})
it('should parse headings and a category shield', () => {
const input = stripIndent`
## Summary
My summary
![category](https://img.shields.io/badge/release_category-Components-blue)
## Release Note
My release notes
### BREAKING CHANGES
Some breaking changes
`
const expected = {
summary: 'My summary',
'release category': 'Components',
'release note': 'My release notes',
'breaking changes': 'Some breaking changes',
}
expect(getSections(input)).toEqual(expected)
})
})
describe('getCommitParts', () => {
// it('should leave the ')
it('should extract the parts of a commit message', () => {
const input = stripIndent`
feat(tooltip): Fix OverflowTooltip with SVG icons in IE11 (#1234)
My summary
[category:Components]
Release Note:
My release notes
### BREAKING CHANGES
Some breaking changes
`
const expected = {
title: 'feat(tooltip): Fix OverflowTooltip with SVG icons in IE11',
pull_request: '1234',
category: 'Components',
'release note': 'My release notes',
'breaking change': 'Some breaking changes',
}
expect(getCommitParts(input)).toEqual(expected)
})
it('should remove the breaking indicator from the title', () => {
const input = stripIndent`
feat(tooltip)!: Fix OverflowTooltip with SVG icons in IE11 (#1234)
`
const expected = {
title: 'feat(tooltip): Fix OverflowTooltip with SVG icons in IE11',
pull_request: '1234',
category: 'Components',
}
expect(getCommitParts(input)).toEqual(expected)
})
it('should guess that "ci:" is infrastructure', () => {
const input = stripIndent`
ci: Upgrade to Github Actions (#1234)
My summary
`
const expected = {
title: 'ci: Upgrade to Github Actions',
pull_request: '1234',
category: 'Infrastructure',
}
expect(getCommitParts(input)).toEqual(expected)
})
})

The tests are set up the following way:

  • input: The PR body. The contents of a Dependabot PR could be copy/pasted into the test
  • expected: The sections that will be passed to create a merge title and body

For example, the linked PR should produce an expected sections like the following:

      const expected = {
        summary: 'Bumps [prismjs](https://github.com/PrismJS/prism) from 1.25.0 to 1.27.0.',
        'release category': 'Dependencies',
      }

No other code needs to be updated other than utils.ts and utils.test.ts which means the code should be 100% unit tested without worry our CI will crash!

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.