This is an action for GitHub that "pings" a repository branch by creating an empty commit and pushing to a specified branch. This is typically used to just trigger a GitHub action from another action's workflow.
To use this action in your own workflow, just provide it with
the following parameters:
repository
: The target repository name, with owner name separated by a slash, such asnasa-pds/pdsen-corral
.token
: A GitHub personal access tokenbranch
: The name of the branch to which to send the empty commit.message
: The log message to use with the commit.
Note that in order to make the "ping" or "empty commit" to a repository, this action must havea access to repositories. This is afforded by the token
. To set up such a token:
- Vist your GitHub account's Settings.
- Go to "Developer Settings".
- Go to "Personal access tokens".
- Press "Generate new token"; authenticate if needed.
- Add a note for the token, such as "PDS Ping Repo Access"
- Check the following scopes:
repo:status
repo_deployment
public_repo
- Press "Generate new token"
Save the token (a hex string) and install it in your source, not target, repository:
- Visit the source repository's web page on GitHub.
- Go to "Settings".
- Go to "Secrets".
- Press "New secret".
- Name the secret, such as
ADMIN_GITHUB_TOKEN
, and insert the token's saved hex string as the value. - Press "Add secret".
Use this name in the source's workflow, such as ${{secrets.ADMIN_GITHUB_TOKEN}}
. You should now destroy any saved copies of the token's hex string.
The following is a brief example how a workflow that shows how this action can be used:
name: 👩🏫 Stable Genius Release
on:
push:
branches:
- master
jobs:
build:
name: 👷♀️ Build Job
runs-on: ubuntu-latest
steps:
- name: 💳 Check out the code
uses: actions/checkout@v2
- name: 🔧 Do something with it
uses: …
- name: 📡 Ping the PDS Engineering Corral
uses: NASA-PDS/git-ping@master
with:
repository: nasa-pds/pdsen-corral
token: ${{secrets.ADMIN_GITHUB_TOKEN}}
branch: master
message: Stable Genius service upgraded to ${{github.ref}}