`@actions/core` support tree shaking when bundled in a GitHub Action.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.9k
- Forks
- 1.8k
- PR merge metrics
- No merged PRs in 30d
Description
Describe the enhancement
At the moment, when using @actions/core npm package in your own bundled GitHub action, the bundler is unable to tree shake unused code from @actions/core.
Additional information
If we do the below, it should help most bundlers to determine what can be removed from @actions/core when bundling.
Add to packages/core/package.json
"sideEffects": false,
Arrow Functions
Along with using arrow functions instead of the traditional function expression
export function getInput() {
...
}
to
export const getInput = () => {
...
}
Entry point
Add a packages/core/src/index.ts entry point that individuals exports.
For example
export {
addPath,
exportVariable,
getBooleanInput,
getInput,
getMultilineInput,
setCommandEcho,
setOutput,
setSecret
} from './core'
Circular dependency issue
The 'import' structure also has a circular dependency issue, where files sometimes import each other.
For example core.ts and oidc-utils.ts import each other.
Refactoring the structure of files and function usage would resolve this issue and help with tree shaking when bundling.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packages/core/package.json and the package source files packages/core/src/core.ts and packages/core/src/oidc-utils.ts. Review the current exports and circular imports, then assess the proposed packages/core/src/index.ts entry point and sideEffects metadata against the package's bundling behavior. Done means unused @actions/core code can be tree-shaken while the documented exports continue to work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions, typescript
- Domain
- build-system, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100