ghapg: GitHub Actions Playground. Repo of GitHub Actions experiments and PoCs.
Both do the exact same thing and are used the exact same way, but built differently:
-
reply-nodejs
runs node.js (using the GitHub Actions Toolkit). -
reply-docker
runs Bash inside a Docker container (usingjq
&curl
)
This exercise shows how to obtain the GitHub event payload in each case, as well as using the GitHub App token to make an authenticated GitHub API call (i.e. posting an issue comment).
This demonstrates the 3 (AFAIK) ways to run a GitHub Action:
reply-nodejs
, node.js [1]reply-docker
, Docker image:- from GitHub [2]
- from a published image [3]
[1] and [2] are actual GitHub Actions, with an action.yml
metadata file.
See .github/workflows/pong.yml, reply-nodejs
and reply-docker
for usage.
Write an issue comment in this repo to get a response from all 3!
[3] while not being an Action per se, is the exact same as [2] but instead of using an action.yml
(and building a Dockerfile
), GitHub pulls an image previously pushed to a container registry (e.g.). Any passing of arguments and environments done in [2]'s action.yml
must be done explicitly in the Workflow file (using args
, env
, etc.). e.g.:
pong-docker-hub:
runs-on: ubuntu-latest
steps:
- uses: docker://pndurette/reply-docker:latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Similar to reply-docker
but demonstrates a popular usage of GitHub comments: creating custom comment "commands", i.e. /command <argument>
.