\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{KingMobile.jpg} \pdfinfo{ /Title (github-contexts-and-default-environment-variables.pdf) /Creator (Cheatography) /Author (KingMobile.jpg) /Subject (Github Contexts \& Default Environment Variables Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{918D56} \definecolor{LightBackground}{HTML}{F8F7F4} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{Github Contexts \& Default Environment Variables Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{KingMobile.jpg} via \textcolor{DarkBackground}{\uline{cheatography.com/141872/cs/30472/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}KingMobile.jpg \\ \uline{cheatography.com/kingmobile-jpg} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 23rd June, 2022.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{4} \begin{tabularx}{3.833cm}{x{0.99557 cm} x{2.43743 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Context Overview}} \tn % Row 0 \SetRowColor{LightBackground} {\bf{Context Name}} & {\bf{Description}} \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} `github` & Information about the workflow run \tn % Row Count 4 (+ 2) % Row 2 \SetRowColor{LightBackground} `env` & Environment variables set in a workflow, job, or step \tn % Row Count 6 (+ 2) % Row 3 \SetRowColor{white} `job` & Information about the currently executing job \tn % Row Count 8 (+ 2) % Row 4 \SetRowColor{LightBackground} `steps` & Information about the steps that have been run in this job \tn % Row Count 11 (+ 3) % Row 5 \SetRowColor{white} `runner` & Information about the runner that is running the current job \tn % Row Count 14 (+ 3) % Row 6 \SetRowColor{LightBackground} `secrets` & Enables access to secrets \tn % Row Count 15 (+ 1) % Row 7 \SetRowColor{white} `strategy` & Enables access to the configured strategy parameters and information about the current job. Strategy parameters include fail-fast, job-index, job-total, and max-parallel \tn % Row Count 22 (+ 7) % Row 8 \SetRowColor{LightBackground} `matrix` & Enables access to the matrix parameters you configured for the current job. For example, if you configure a matrix build with the os and node versions, the matrix context object includes the os and node versions of the current job \tn % Row Count 31 (+ 9) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{3.833cm}{x{0.99557 cm} x{2.43743 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Context Overview (cont)}} \tn % Row 9 \SetRowColor{LightBackground} `needs` & Enables access to the outputs of all jobs that are defined as a dependency of the current job \tn % Row Count 4 (+ 4) % Row 10 \SetRowColor{white} `inputs` & Enables access to the inputs of reusable workflow \tn % Row Count 6 (+ 2) \hhline{>{\arrayrulecolor{DarkBackground}}--} \SetRowColor{LightBackground} \mymulticolumn{2}{x{3.833cm}}{Taken from \seqsplit{htttps://docs.github.com/en/actions/learn-github-actions/contexts}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.15254 cm} p{0.78858 cm} x{1.09188 cm} } \SetRowColor{DarkBackground} \mymulticolumn{3}{x{3.833cm}}{\bf\textcolor{white}{Access context information}} \tn % Row 0 \SetRowColor{LightBackground} Index syntax: & Example: github{[}'sha'{]} & \tn % Row Count 3 (+ 3) % Row 1 \SetRowColor{white} Property dereference syntax: & Example: \seqsplit{github.sha} & \tn % Row Count 5 (+ 2) % Row 2 \SetRowColor{LightBackground} {\bf{Note that in order to use property dereference syntax, property name must:}} & -{}-\textgreater{} Start with `a-Z` or `\_` & -{}-\textgreater{} Be followed by `a-Z`, `0-9` or `\_` \tn % Row Count 11 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}---} \SetRowColor{LightBackground} \mymulticolumn{3}{x{3.833cm}}{Taken from \seqsplit{https://docs.github.com/en/actions/learn-github-actions/contexts}} \tn \hhline{>{\arrayrulecolor{DarkBackground}}---} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{3.833cm}{x{1.20155 cm} x{2.23145 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Default Environment Variables}} \tn % Row 0 \SetRowColor{LightBackground} Environment Variable & Description \tn % Row Count 2 (+ 2) % Row 1 \SetRowColor{white} `CI` & Always `true` \tn % Row Count 3 (+ 1) % Row 2 \SetRowColor{LightBackground} \seqsplit{`GITHUB\_WORKFLOW`} & Name of the workflow \tn % Row Count 5 (+ 2) % Row 3 \SetRowColor{white} \seqsplit{`GITHUB\_RUN\_ID`} & Unique number for each run within a repository. This number does not change if you re-run the workflow run. \tn % Row Count 10 (+ 5) % Row 4 \SetRowColor{LightBackground} \seqsplit{`GITHUB\_RUN\_NUMBER`} & Unique number for each run of a particular workflow in a repository. This number begins at 1 for the workflow's first run, and increments with each new run. This number does not change if you re-run the workflow run. \tn % Row Count 19 (+ 9) % Row 5 \SetRowColor{white} `GITHUB\_JOB` & The job\_id of the current job \tn % Row Count 21 (+ 2) % Row 6 \SetRowColor{LightBackground} \seqsplit{`GITHUB\_ACTION`} & Unique identifier (id) of the action \tn % Row Count 23 (+ 2) % Row 7 \SetRowColor{white} \seqsplit{`GITHUB\_ACTION\_PATH`} & The path where your action is located. You can use this path to access files located in the same repository as your action. This variable is only supported in composite actions \tn % Row Count 30 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{3.833cm}{x{1.20155 cm} x{2.23145 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Default Environment Variables (cont)}} \tn % Row 8 \SetRowColor{LightBackground} \seqsplit{`GITHUB\_ACTIONS`} & Always set to `true` when GitHub Actions is running the workflow. You can use this variable to differentiate when tests are being run locally or by GitHub Actions \tn % Row Count 7 (+ 7) % Row 9 \SetRowColor{white} \seqsplit{`GITHUB\_ACTOR`} & The name of the person or app that initiated the workflow \tn % Row Count 10 (+ 3) % Row 10 \SetRowColor{LightBackground} \seqsplit{`GITHUB\_REPOSITORY`} & The owner and repository name \tn % Row Count 12 (+ 2) % Row 11 \SetRowColor{white} \seqsplit{`GITHUB\_EVENT\_NAME`} & The name of the webhook event that triggered the workflow \tn % Row Count 15 (+ 3) % Row 12 \SetRowColor{LightBackground} \seqsplit{`GITHUB\_EVENT\_PATH`} & The path of the file with the complete webhook event payload \tn % Row Count 18 (+ 3) % Row 13 \SetRowColor{white} \seqsplit{`GITHUB\_WORKSPACE`} & The GitHub workspace directory path, initially empty. For example, \seqsplit{/home/runner/work/my-repo-name/my-repo-name}. The actions/checkout action will check out files, by default a copy of your repository, within this directory \tn % Row Count 27 (+ 9) % Row 14 \SetRowColor{LightBackground} `GITHUB\_SHA` & The commit SHA that triggered the workflow \tn % Row Count 29 (+ 2) % Row 15 \SetRowColor{white} `GITHUB\_REF` & The branch or tag ref that triggered the workflow. For example, \seqsplit{refs/heads/feature-branch-1}. If neither a branch or tag is available for the event type, the variable will not exist \tn % Row Count 36 (+ 7) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{3.833cm}{x{1.20155 cm} x{2.23145 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Default Environment Variables (cont)}} \tn % Row 16 \SetRowColor{LightBackground} \seqsplit{`GITHUB\_REF\_NAME`} & The branch or tag name that triggered the workflow ru \tn % Row Count 3 (+ 3) % Row 17 \SetRowColor{white} \seqsplit{`GITHUB\_REF\_PROTECTED`} & `true` if branch protections are configured for the ref that triggered the workflow run \tn % Row Count 7 (+ 4) % Row 18 \SetRowColor{LightBackground} \seqsplit{`GITHUB\_REF\_TYPE`} & The type of ref that triggered the workflow run. Valid values are `branch` or `tag` \tn % Row Count 11 (+ 4) % Row 19 \SetRowColor{white} \seqsplit{`GITHUB\_HEAD\_REF`} & Only set for pull request events. The name of the head branch \tn % Row Count 14 (+ 3) % Row 20 \SetRowColor{LightBackground} \seqsplit{`GITHUB\_BASE\_REF`} & Only set for pull request events. The name of the base branch \tn % Row Count 17 (+ 3) % Row 21 \SetRowColor{white} \seqsplit{`GITHUB\_SERVER\_URL`} & Returns the URL of the GitHub server. For example: `https://github.com` \tn % Row Count 20 (+ 3) % Row 22 \SetRowColor{LightBackground} \seqsplit{`GITHUB\_API\_URL`} & Returns the API URL. For example: `https://api.github.com` \tn % Row Count 23 (+ 3) % Row 23 \SetRowColor{white} \seqsplit{`GITHUB\_GRAPHQL\_URL`} & Returns the GraphQL API URL. For example: \seqsplit{`https://api.github.com/graphql`} \tn % Row Count 26 (+ 3) % Row 24 \SetRowColor{LightBackground} `RUNNER\_NAME` & The name of the runner executing the job \tn % Row Count 28 (+ 2) % Row 25 \SetRowColor{white} `RUNNER\_OS` & The operating system of the runner executing the job. Possible values are `Linux`, `Windows`, or `macOS` \tn % Row Count 32 (+ 4) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{3.833cm}{x{1.20155 cm} x{2.23145 cm} } \SetRowColor{DarkBackground} \mymulticolumn{2}{x{3.833cm}}{\bf\textcolor{white}{Default Environment Variables (cont)}} \tn % Row 26 \SetRowColor{LightBackground} `RUNNER\_ARCH` & The architecture of the runner executing the job. Possible values are `X86`, `X64`, `ARM`, and `ARM64` \tn % Row Count 4 (+ 4) % Row 27 \SetRowColor{white} `RUNNER\_TEMP` & The path to a temporary directory on the runner. This directory is emptied at the beginning and end of each job. Note that files will not be removed if the runner's user account does not have permission to delete them. \tn % Row Count 13 (+ 9) % Row 28 \SetRowColor{LightBackground} \seqsplit{`RUNNER\_TOOL\_CACHE`} & The path to the directory containing preinstalled tools for GitHub-hosted runners \tn % Row Count 17 (+ 4) \hhline{>{\arrayrulecolor{DarkBackground}}--} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}