Skip to content

dump env context

dump env context #61

Workflow file for this run

# based on https://docs.github.com/en/actions/learn-github-actions/contexts#example-printing-context-information-to-the-log
name: dump context
on:
push:
pull_request:
workflow_dispatch:
schedule:
- cron: "51 17 * * 3" # once a week, https://crontab.guru/#51_17_*_*_3
jobs:
dump_contexts_to_log:
name: ${{ github.event_name }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Dump github context
run: echo '${{ toJSON(github) }}' | jq . -C
- name: Dump job context
run: echo '${{ toJSON(job) }}' | jq . -C
- name: Dump steps context
run: echo '${{ toJSON(steps) }}' | jq . -C
- name: Dump runner context
run: echo '${{ toJSON(runner) }}' | jq . -C
- name: Dump strategy context
run: echo '${{ toJSON(strategy) }}' | jq . -C
- name: Dump matrix context
run: echo '${{ toJSON(matrix) }}' | jq . -C
- name: Dump env context
run: echo '${{ toJSON(env) }}' | jq . -C
- name: Dump all contexts to a file
run: |
echo '{"github": ${{ toJSON(github) }},' > contexts.json
echo '"job": ${{ toJSON(job) }},' >> contexts.json
echo '"steps": ${{ toJSON(steps) }},' >> contexts.json
echo '"runner": ${{ toJSON(runner) }},' >> contexts.json
echo '"strategy": ${{ toJSON(strategy) }},' >> contexts.json
echo '"matrix": ${{ toJSON(matrix) }} }' >> contexts.json
jq . contexts.json > contexts/${{ github.event_name }}.json
jq . -C contexts.json
rm contexts.json
- name: Set current date
run: echo "CURRENT_DATE=$(date --utc --iso)" >> $GITHUB_ENV
- name: Deploy contexts
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "contexts for ${{ github.event_name }} on ${{ env.CURRENT_DATE }}\n\n${{ github.event.repository.html_url }}/actions/runs/${{ github.run_id }}"