Skip to content

Commit 42fd8ef

Browse files
committed
Add checking of GitHub status and outputting of workflow context
These additions are optional and by default are not applied.
1 parent d960335 commit 42fd8ef

File tree

2 files changed

+28
-3
lines changed

2 files changed

+28
-3
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,22 @@
22

33
[![GitHub Build Status](https://github.com/cisagov/action-job-preamble/workflows/build/badge.svg)](https://github.com/cisagov/action-job-preamble/actions)
44

5-
A GitHub Action to apply the standard permissions monitoring and
6-
runner hardening. This Action is intended to be applied at the
7-
beginning of every GitHub Actions job.
5+
A GitHub Action to apply the standard permissions monitoring, runner
6+
hardening, GitHub status checking, and output the workflow context.
7+
This Action is intended to be applied at the beginning of every GitHub
8+
Actions job.
89

910
## Usage ##
1011

1112
### Inputs ###
1213

1314
| Name | Description | Interpreted Type | Default | Required |
1415
|------|-------------|------------------|---------|:--------:|
16+
| check_github_status | A Boolean (`"true"`/`"false"`) value indicating whether or not to check GitHub status using the [crazy-max/ghaction-github-status](https://github.com/crazy-max/ghaction-github-status) GitHub action. | `bool` | `false` | no |
1517
| harden_runner | A Boolean (`"true"`/`"false"`) value indicating whether or not to harden the runner using the [step-security/harden-runner](https://github.com/step-security/harden-runner) GitHub action. | `bool` | `true` | no |
1618
| harden_runner_egress_policy | The egress policy to use for runner hardening. Valid values are audit and block. See [step-security/harden-runner](https://github.com/step-security/harden-runner) for more details. | `string` | `audit` | no |
1719
| monitor_permissions | A Boolean (`"true"`/`"false"`) value indicating whether or not to monitor GitHub permission requests using the [GitHubSecurityLab/actions-permission/monitor](https://github.com/GitHubSecurityLab/actions-permission/monitor) GitHub action. | `bool` | `true` | no |
20+
| output_workflow_context | A Boolean (`"true"`/`"false"`) value indicating whether or not to output the workflow context using the [crazy-max/ghaction-dump-context](https://github.com/crazy-max/ghaction-dump-context) GitHub action. | `bool` | `false` | no |
1821
| permissions_monitoring_config | A JSON string containing the configuration to use for permissions monitoring. In the case of cisagov you will usually want to set this to `${{ vars.ACTIONS_PERMISSIONS_CONFIG }}` so it agrees with our organization-wide GitHub Actions permissions monitoring configuration. See [the documentation for the GitHubSecurityLab/actions-permissions/monitor action](https://github.com/GitHubSecurityLab/actions-permissions/tree/main/monitor#configuration) for more details. | `string` | `""` | no |
1922

2023
### Outputs ###

action.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ description: >-
99
name: Job preamble
1010

1111
inputs:
12+
check_github_status:
13+
default: "false"
14+
description: >-
15+
A Boolean ("true"/"false") value indicating whether or not to
16+
check GitHub status using the crazy-max/ghaction-github-status
17+
GitHub action.
18+
required: false
1219
harden_runner:
1320
default: "true"
1421
description: >-
@@ -30,6 +37,13 @@ inputs:
3037
monitor GitHub permission requests using the
3138
GitHubSecurityLab/actions-permission/monitor GitHub action.
3239
required: false
40+
output_workflow_context:
41+
default: "false"
42+
description: >-
43+
A Boolean ("true"/"false") value indicating whether or not to
44+
output the workflow context using the
45+
crazy-max/ghaction-dump-context GitHub action.
46+
required: false
3347
permissions_monitoring_config:
3448
default: ""
3549
description: >-
@@ -66,3 +80,11 @@ runs:
6680
uses: step-security/harden-runner@v2
6781
with:
6882
egress-policy: ${{ inputs.harden_runner_egress_policy }}
83+
- id: check-github-status
84+
if: ${{ inputs.check_github_status == 'true' }}
85+
name: Check GitHub status
86+
uses: crazy-max/ghaction-github-status@v4
87+
- id: output-workflow-context
88+
if: ${{ inputs.output_workflow_context == 'true' }}
89+
name: Output workflow context
90+
uses: crazy-max/ghaction-dump-context@v2

0 commit comments

Comments
 (0)