🛠 A toolkit for building GitHub Actions in Node.js
MIT License
Bot releases are visible (Hide)
Just a couple of dependency updates for security!
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!
Published by release-drafter[bot] over 4 years ago
There are a couple of major improvements that are unfortunately breaking changes:
tools.context.issue
returns a different objectThanks 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 removedThis 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!
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!
Published by release-drafter[bot] over 4 years ago
Published by release-drafter[bot] over 4 years ago
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.Toolkit#config
has been removed. You should probably use tools.inputs
instead!tools.arguments
has been removed. You should probably use tools.inputs
instead!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️⃣
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 🌬
Published by JasonEtco over 5 years ago
Published by release-drafter[bot] over 5 years ago
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!
context.issue
and context.repo
objects (#61) @jclemPublished by release-drafter[bot] over 5 years ago
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!
Published by release-drafter[bot] over 5 years ago
tools.log
(#69) @JasonEtcoPublished 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.
secrets
option (#66) @JasonEtcotools.log
(#69) @JasonEtcoPublished by release-drafter[bot] over 5 years ago
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 ✨
secrets
option (#66) @JasonEtcoPublished by release-drafter[bot] over 5 years ago
Published by release-drafter[bot] over 5 years ago
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!')
})
Published by release-drafter[bot] over 5 years ago
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
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.
Published by JasonEtco over 5 years ago
This release introduces a few breaking changes, for reliability and for clarity.
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 #61I 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 getter
s 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.
Published by release-drafter[bot] over 5 years ago
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' }
})