-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can we deprecate @actions/github
in favor of @octokit/action
?
#334
Comments
Hi @gr2m, Thank you for your interest in helping the GitHub Actions developer community. One of our goals with maintaining the toolkit and this repo is providing a single place where the Actions developer community can go for help and to provide feedback to the product team. Further, given the nature of many Actions being more than running CI we consider interacting with the GitHub API to be a very core feature that the toolkit should offer. With that in mind, would you consider making a pull request into the github module to enable direct interaction with the Octokit library so developers can make use of the plugin model? |
I don't think one contradicts the other. I'd definitely keep the Actions toolkit, I'd just remove the part where you wrap const github = require('@actions/github'); people would do const { Octokit } = require('@octokit/action');
const octokit = new Octokit() That is also the place where people could load custom plugins const { Octokit } = require('@octokit/action');
const MyOctokit = Octokit.plugin([myplugin1, myplugin2])
const octokit = new Octokit() The problem I see is that
I can send a pull request to update |
One extra functionality that this action provides, and would need some way to migrate is: const { GitHub, context } = require('@actions/github')
const github = new GitHub(process.env.GITHUB_TOKEN)
const { owner, repo } = context.repo
let { data: releases } = await github.repos.listReleases({ owner, repo }) i.e. it's easy to know the owner and repo of the running action, which is convenient. |
You can do const [owner, repo] = process.env.GITHUB_REPOSITORY.split('/') All that context does is reading out the environment variables. All the environment variables are documented. I can also create a plugin which adds back that functionality for an easier migration const core = require('@actions/core');
const { Octokit } = require('@octokit/rest')
const { actionContext } = require('octokit-plugin-action-context')
const ActionOctokit = Octokit.plugin(actionContext)
const octokit = new ActionOctokit({ auth: core.getInput('myToken') })
const { owner, repo } = octokit.context.repo |
People keep running into issues because of |
True, reading it out of |
Is the ref also available via |
Yes: |
I created the Octokit plugin to ease the transition: The implementation does not have the checks if the The type for |
is this still relevant now that |
No I think we can close this now, cheers |
Describe the enhancement
It's rather confusing that both these modules exist.
@actions/github
is mostly wrapping@octokit/rest
right now anyway. That's what@octokit/action
does to, but with the benefit that I keep it up-to-date as part of the JavaScript Octokit SDKs.Also Ocotkit comes with a plugin architecture. There is a growing list of scenarios that are nicely wrapped in a plugin so people don't have to re-create it. Here is an example: http://github.com/gr2m/octokit-plugin-create-pull-request
Code Snippet
Before
would become
Optionally add plugins and default settings
Additional information
Add any other context about the feature here.
The text was updated successfully, but these errors were encountered: