Skip to content
This repository was archived by the owner on Dec 9, 2022. It is now read-only.

machine-learning-apps/actions-app-token

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Actions Status

Impersonate Your GitHub App In A GitHub Action

This action helps you retrieve an authenticated app token with an app id and a private key. You can use this key inside an actions workflow instead of GITHUB_TOKEN, in cases where the GITHUB_TOKEN has restricted rights

Why Would You Do This?

For example, a pull request events from forked repositories are hydrated with a GITHUB_TOKEN that has read-only access. Unfortunately, this means that PRs opened from forks cannot use Actions like the first-interaction Action that greets new contributors, because the token does not have authority to comment on the PR.

Usage

  1. Register a GitHub App (or use an existing one you own), and install this app on your repos. No need to setup an endpoint or a webhook (you can put in fake urls for these) as you can use this app for the purposes of Action workflows only if you like.

  2. Creation a workflow file in .github/workflows/

    See action.yml for the api spec.

Example:

steps:
- name: Get token
  id: get_token
  uses: machine-learning-apps/actions-app-token@master
  with:
    APP_PEM: ${{ secrets.APP_PEM }}
    APP_ID: ${{ secrets.APP_ID }}

# see https://github.com/actions/first-interaction
- name: greet new contributors
  uses: actions/first-interaction@v1
  with:
    repo-token: ${{ steps.get_token.output.token }} # instead of ${{ secrets.GITHUB_TOKEN }}
    pr-message: 'Message that will be displayed on users' first pr. Look, a `code block` for markdown.'

License

The scripts and documentation in this project are released under the MIT License.

Notes

This action is being actively used for fastpages-chatops

About

Impersonate a GitHub App Token inside Actions

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors