Dump GitHub Events
For development, it may be useful to dump GitHub event info.
name: "Dump GitHub Event"
on:
push:
pull_request:
workflow_dispatch:
release:
permissions: {}
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
dump_event:
runs-on: ubuntu-24.04
name: Dump GitHub event info for debugging
permissions:
contents: read
steps:
- name: Dump event
run: jq . "$GITHUB_EVENT_PATH"
- name: Upload event file
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: github-event
path: ${{ github.event_path }}
# Includes a short lived token
# - name: Dump github context
# env:
# CONTEXT: ${{ toJSON(github) }}
# CONTEXT_PATH: ${{ github.workspace }}/github-context.json
# run: echo "$CONTEXT" | tee "$CONTEXT_PATH" | jq .
# - name: Save github context
# uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
# with:
# name: github-context
# path: ${{ github.workspace }}/github-context.json
- name: Environment variables
run: printenv
- name: PR merge JSON
if: github.event_name == 'push'
env:
REPO: ${{ github.repository }}
GIT_SHA: ${{ github.sha }}
GH_TOKEN: ${{ github.token }}
PR_MERGE_JSON: ${{ github.workspace }}/pr-merge.json
run: |
{ gh api "repos/$REPO/commits/$GIT_SHA/pulls" --jq '.[0] // empty' || true; } | tee "$PR_MERGE_JSON"
- name: Upload PR merge JSON
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: pr-merge
path: ${{ github.workspace }}/pr-merge.json