actions-toolkit

🛠 A toolkit for building GitHub Actions in Node.js

MIT License

Downloads
89.2K
Stars
928
Committers
18

Bot releases are visible (Hide)

actions-toolkit - v6.0.1 Latest Release

Published by release-drafter[bot] about 4 years ago

Just a couple of dependency updates for security!

What’s Changed

  • Bump node-fetch from 2.6.0 to 2.6.1 (#132) @dependabot
  • Bump @actions/core from 1.2.4 to 1.2.6 (#133) @dependabot
actions-toolkit - v6.0.0

Published by release-drafter[bot] about 4 years ago

This release includes two TypeScript changes - in an abundance of caution I've marked it as a new major version, but there aren't any changes other than the two PRs below. Have fun!

What’s Changed

  • Improve types for context.issue/pull_request (#131) @JasonEtco
  • fix: return never from exit functions (#129) @likern
actions-toolkit - v5.0.0

Published by release-drafter[bot] over 4 years ago

Breaking Changes

There are a couple of major improvements that are unfortunately breaking changes:

tools.context.issue returns a different object

Thanks to @mheap, tools.context.issue now returns { owner, repo, issue_number } instead of { owner, repo, number }. This is due to a change in the Octokit SDK. To have parity with pull requests, there is now also tools.context.pullRequest, which returns { owner, repo, pull_number }.

See #118 for more information!

Toolkit#getFile is now Toolkit#readFile

The getFile method has been renamed to readFile, and the behavior has changed. It now uses fs.promises.readFile under the hood, so it returns a promise:

const tools = new Toolkit({ ... })
const contents = await tools.readFile('README.md')

See #121 for more information!

tools.store has been removed

This feature was added before the Actions runtime had a way to share data between actions. That now exists in the platform, as "outputs"! See #125 for the removal of Store, and #120 for it's "replacement", tools.outputs (thanks to @abouroubi ✨):

tools.outputs.example = 'foo'

Toolkit#runInWorkspace is now Toolkit#exec

This method was useful, but @actions/exec is built more with the Actions runner in mind. So, now Toolkit#exec calls @actions/exec! This will be more stable for the finicky, ephemeral environments of Actions.

See #123 for more information!


What’s Changed

  • Fix deprecated issue/pull number context (#118) @mheap
  • Moar tests (#126) @JasonEtco
  • Toolkit#runInWorkspace => Toolkit#exec (#123) @JasonEtco
  • Remove Store (#125) @JasonEtco
  • Support github_token input in addition to env.GITHUB_TOKEN (#124) @JasonEtco
  • feat(outputs): add outputs proxy to the toolkit (#120) @abouroubi
  • Improve Toolkit#readFile (#121) @JasonEtco
  • Updoots (#122) @JasonEtco
actions-toolkit - v4.0.0

Published by release-drafter[bot] over 4 years ago

This release only upgrades the bundled version of @octokit/rest tov17. See #109 for more details, but the breaking changes are best found in the @octokit/rest release!

actions-toolkit - v3.0.2

Published by release-drafter[bot] over 4 years ago

What’s Changed

  • Update dependencies (#117) @JasonEtco
  • Fix broken actions events link (#113) @outsideris
  • Point to actions/checkout if getFile throws (#115) @JasonEtco
  • Bump minimist from 1.2.0 to 1.2.2 (#112) @dependabot
  • Bump acorn from 6.4.0 to 6.4.1 (#111) @dependabot
actions-toolkit - v3.0.0

Published by release-drafter[bot] over 4 years ago

New features

This release brings a lot of new features that are available in the Actions runtime, mostly by wrapping actions/toolkit.

  • tools.inputs is a Proxy instance that lets you access the inputs of your action:
uses: JasonEtco/example-action@master
with:
  foo: bar

You can access those using tools.inputs:

console.log(tools.inputs.foo) // -> 'bar'
  • Toolkit.run will now call core.setFailed upon failure, which sets an annotation to expose the error message more clearly in the GitHub Actions UI.

Breaking changes

  • Toolkit#config has been removed. You should probably use tools.inputs instead!
  • tools.arguments has been removed. You should probably use tools.inputs instead!

What’s Changed

  • Allow custom token to be supplied in options (#97) @danez
  • Wrap @actions/core and enable new features (#107) @JasonEtco
  • Update dependencies (#106) @JasonEtco
  • Bump handlebars from 4.1.2 to 4.5.3 (#104) @dependabot
actions-toolkit - v2.2.0

Published by release-drafter[bot] about 5 years ago

This release includes some package updates, improvements to the published library (thanks @kevinpollet!) and an addition of action.yml to the generated template. This is to support GitHub Actions v2 🎉 2️⃣

What’s Changed

  • Use GitHub Actions for CI (#102) @JasonEtco
  • Create actions with action.yml (#101) @JasonEtco
  • npm audit fix (#100) @JasonEtco
  • Add a note to the README about actions/toolkit (#99) @JasonEtco
  • Bump lodash from 4.17.11 to 4.17.14 (#96) @dependabot
  • add link to octokit/graphql repo for documentation (#95) @bdougie
  • Bump js-yaml from 3.13.0 to 3.13.1 (#93) @dependabot
  • Bump handlebars from 4.1.0 to 4.1.2 (#92) @dependabot
  • Use a whitelist to specify files included in published package (#89) @kevinpollet
  • Add Node.js 12 to Travis CI build matrix (#90) @kevinpollet
actions-toolkit - v2.1.0

Published by release-drafter[bot] over 5 years ago

This release is focused on improved TypeScript definitions and documentation upgrades! Now, types for modules that actions-toolkit directly exposes are included, so writing Actions in TypeScript should be a breeze 🌬

What’s Changed

  • Additional Info on the Intro part (#87) @evdama
  • Use @types/flat-cache dependency (#88) @kevinpollet
  • Add context about how/why/what (#1) @evdama
actions-toolkit - 2.0.0

Published by JasonEtco over 5 years ago

actions-toolkit - v2.0.0

Published by release-drafter[bot] over 5 years ago

Breaking changes

This release introduces breaking changes to tools.context.repo and tools.context.issue. Those are now properties instead of methods - here's the difference:

-tools.context.repo({
-  foo: true
-})
+{
+  ...tools.context.repo
+  foo: true
+}

Usage is the same as always, but using the object spread operator instead of passing an object to a method:

tools.github.issues.create({
  ...tools.context.repo,
  title: 'New issue'
})

This should help make those getters more clear and easier to use. As always, feel free to open an issue if you have feedback on this change!

What’s Changed

  • Use GITHUB_REPOSITORY for context.repo (#75) @JasonEtco
  • Make context.issue and context.repo objects (#61) @jclem
  • [email protected] (#62) @JasonEtco
actions-toolkit - v1.10.0

Published by release-drafter[bot] over 5 years ago

Testing!

This release improves the CLI scaffold template with a new file: index.test.js. It outlines a pattern for testing GItHub Actions with actions-toolkit, leveraging Toolkit.run. Try it out with:

npx actions-toolkit <folder>

I'll be sharing some docs on this soon!

What’s Changed

  • Fix publish workflow (#72) @JasonEtco
  • Include test file in CLI scaffold (#73) @JasonEtco
actions-toolkit - v1.9.1

Published by release-drafter[bot] over 5 years ago

What’s Changed

  • Fix missing methods on tools.log (#69) @JasonEtco
  • Remove GITHUB_REF and GITHUB_TOKEN from required env vars (#71) @JasonEtco
actions-toolkit - v2.0.0-beta.2

Published by JasonEtco over 5 years ago

This release furthers the beta of v2.0.0 (#62). It reverts the changes added in #41 for exiting with a failing status with missing environment variables - this is due to additional friction and inconsistent lists that made the feature a little unreliable, so better to remove it.

What’s Changed

  • Use logger in exit (#64) @JasonEtco
  • Create CLI questionnaire (#57) @macklinu
  • Add Toolkit.run (#63) @jclem
  • Support non-async functions in Toolkit.run (#67) @JasonEtco
  • Add secrets option (#66) @JasonEtco
  • Fix missing methods on tools.log (#69) @JasonEtco
  • Remove GITHUB_REF and GITHUB_TOKEN from required env vars (#71) @JasonEtco
actions-toolkit - v1.9.0: `secrets` option

Published by release-drafter[bot] over 5 years ago

New feature

This release introduces the secrets option. If present, the Action will exit and fail if required secrets have not been set. Here's an example:

action "My action" {
  uses = "JasonEtco/secrets@master"
  secrets = ["API_KEY"]
}
// This will fail because `API_SECRET` wasn't passed!
new Toolkit({ secrets: ['API_KEY', 'API_SECRET'] })

Check out #66 for all the details ✨

What’s Changed

  • Add secrets option (#66) @JasonEtco
actions-toolkit - v1.8.1

Published by release-drafter[bot] over 5 years ago

What’s Changed

  • Support non-async functions in Toolkit.run (#67) @JasonEtco
actions-toolkit - v1.8.0: Toolkit#run

Published by release-drafter[bot] over 5 years ago

New feature

In #63, @jclem added a new static method to the Toolkit class: #run. It takes a function argument and runs that function, as a way of enabling easier async/await patterns and modularity. Check it out!

const { Toolkit } = require('actions-toolkit')

Toolkit.run(async tools => {
  tools.log.success('We did it team!')
})

What’s Changed

  • Use logger in exit (#64) @JasonEtco
  • Add Toolkit.run (#63) @jclem
actions-toolkit - v1.7.0: CLI Magic

Published by release-drafter[bot] over 5 years ago

Enhanced CLI

This release introduces a wonderfully enhanced CLI tool for creating a new GitHub Action, courtesy of @macklinu. Check out #57 for the full details ✨ You can run it through npx:

npx actions-toolkit my-action

What’s Changed

  • Use logger in exit (#64) @JasonEtco
  • Create CLI questionnaire (#57) @macklinu
actions-toolkit - v2.0.0-beta.1

Published by JasonEtco over 5 years ago

Nothing to see here, just fixing a release process that borked for 2.0.0-beta.1 and resulted in an empty publish.

actions-toolkit - v2.0.0-beta.0

Published by JasonEtco over 5 years ago

This release introduces a few breaking changes, for reliability and for clarity.

Required environment variables, #41

The first is a change to the Toolkit constructor - the list of environment variables that are available in the GitHub Actions runtime is now required when using actions-toolkit. This is to encourage predictability, and while it won't break any Actions being run by GitHub, it may affect automated tests that don't set all of the expected environment variables. I'm really looking for feedback on this change - if it feels too heavy handed, let me know in #62!

context.repo and context.issue are objects, not functions #61

I love this change (shoutout @jclem) - tools.context.repo and tools.context.issue are no longer functions that take an object parameter, but are rather helper getters that return an object:

- const params = tools.context.repo({ foo: true })
+ const params = { ...tools.context.repo, foo: true }

This is much more semantic and standard, and should result in less confusion for folks that aren't familiar with Probot's API.

actions-toolkit - 1.6.0: Toolkit#command

Published by release-drafter[bot] over 5 years ago

New feature

This release introduces Toolkit#command, a new method that will run the provided function when a matching slash-command is found. From the README:

Respond to a slash-command posted in a GitHub issue, comment, pull request, pull request review or commit comment. Arguments to the slash command are parsed by minimist. You can use a slash command in a larger comment, but the command must be at the start of the line:

Hey, let's deploy this!
/deploy --app example --container node:alpine
tools.command('deploy', async (args: ParsedArgs, match: RegExpExecArray) => {
  console.log(args)
  // -> { app: 'example', container: 'node:alpine' }
})

What’s Changed

  • Slash commands (#53) @JasonEtco