Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
@probot/adapter-github-actions
Advanced tools
Adapter to run a Probot application function in GitHub Actions
@probot/adapter-github-actions
Adapter to run a Probot application function in GitHub Actions
Create your Probot Application as always
// app.js
module.exports = (app) => {
app.on("issues.opened", async (context) => {
const params = context.issue({ body: "Hello World!" });
await context.octokit.issues.createComment(params);
});
};
Then in the entrypoint of your GitHub Action, require @probot/adapter-github-actions
instead of probot
// index.js
const { run } = require('@probot/adapter-github-actions')
const app = require("./app");
run(app).catch((error) => {
console.error(error);
process.exit(1);
});
Then use index.js
as your entrypoint in the action.yml
file
name: "Probot app name"
description: "Probot app description."
runs:
using: "node12"
main: "action.js"
Important: Your external dependencies will not be installed, you have to either vendor them in by committing the contents of the node_modules
folder, or compile the code to a single executable script (recommended). See GitHub's documentation
For an example Probot App that is continuously published as GitHub Action, see https://github.com/probot/example-github-action#readme
Probot is a framework for building GitHub Apps, which is different to creating GitHub Actions in many ways, but the functionality is the same:
Both get notified about events on GitHub, which you can act on. While a GitHub App gets notified about a GitHub event via a webhook request sent by GitHub, a GitHub Action can receive the event payload by reading a JSON file from the file system. We can abstract away the differences, so the same hello world example app shown above works in both environments.
Relevant differences for Probot applications:
probot
instance you receive is authenticated using a GitHub token. In most cases the token will be set to secrets.GITHUB_TOKEN
, which is an installation access token. The provided GITHUB_TOKEN
expires when the job is done or after 6 hours, whichever comes first. You do not have access to an APP_ID
or PRIVATE_KEY
, you cannot create new tokens or renew the provided one.secrets.GITHUB_TOKEN
is scoped to the current repository. You cannot read data from other repositories unless they are public, you cannot update any other repositories, or access organization-level APIs.secrets.GITHUB_TOKEN
to workaround the limits of a repository-scoped token, but be sure you know what you are doing.WEBHOOK_SECRET
, because no webhook request gets sent, the event information can directly be retrieved from environment variables and the local file system.For a more thorough comparison, see @jasonetco's posts:
FAQs
Adapter to run a Probot application function in GitHub Actions
The npm package @probot/adapter-github-actions receives a total of 0 weekly downloads. As such, @probot/adapter-github-actions popularity was classified as not popular.
We found that @probot/adapter-github-actions demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.