Skip to content

Commit 9649f89

Browse files
authored
Merge pull request #27 from github/release-setup
Release Setup and Improved Maintainability
2 parents 36a60c3 + 5482bb8 commit 9649f89

File tree

8 files changed

+120
-5
lines changed

8 files changed

+120
-5
lines changed

.dockerignore

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.devcontainer/
2+
.github/
3+
.git/
4+
script/
5+
action.yml
6+
Dockerfile
7+
LICENSE
8+
README.md
9+
tmp/
10+
.vscode/
11+
docs/

.github/workflows/main.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,12 @@ jobs:
1515
steps:
1616
- name: git checkout
1717
uses: actions/checkout@v4
18+
19+
- name: setup go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version-file: 'go.mod'
23+
cache: true
24+
1825
- name: run oidc-debug.go
1926
run: go run cmd/oidc-debug.go -audience "https://github.com/github"

.go-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.24.4

Dockerfile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
FROM alpine:latest
2-
RUN apk add --no-cache go
1+
FROM alpine:3.22.0@sha256:8a1f59ffb675680d47db6337b49d22281a139e9d709335b492be023728e11715
2+
3+
COPY .go-version .go-version
4+
5+
RUN apk add --no-cache go=$(cat .go-version)-r0
36

47
COPY . .
58

README.md

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ This action requests a JWT and prints the claims included within the JWT receive
44

55
## How to use this Action
66

7-
Here's an example of how to use that action:
7+
Here's an example of how to use this action:
88

99
```yaml
1010

11-
on: [pull_request]
11+
name: Test Debugger Action
12+
on:
13+
pull_request:
14+
workflow_dispatch:
1215

1316
jobs:
1417
oidc_debug_test:
@@ -23,3 +26,58 @@ jobs:
2326
with:
2427
audience: '${{ github.server_url }}/${{ github.repository_owner }}'
2528
```
29+
30+
The resulting output in your Actions log will look something like this:
31+
32+
```json
33+
{
34+
"actor": "GrantBirki",
35+
"actor_id": "23362539",
36+
"aud": "https://github.com/github",
37+
"base_ref": "main",
38+
"enterprise": "github",
39+
"enterprise_id": "11468",
40+
"event_name": "pull_request",
41+
"exp": 1751581975,
42+
"head_ref": "release-setup",
43+
"iat": 1751560375,
44+
"iss": "https://token.actions.githubusercontent.com",
45+
"job_workflow_ref": "github/actions-oidc-debugger/.github/workflows/action-test.yml@refs/pull/27/merge",
46+
"job_workflow_sha": "7f93a73b8273af5d35fcd70661704c1cadc57054",
47+
"jti": "4a576b35-ff09-41c5-af2c-ca62dd89b76a",
48+
"nbf": 1751560075,
49+
"ref": "refs/pull/27/merge",
50+
"ref_protected": "false",
51+
"ref_type": "branch",
52+
"repository": "github/actions-oidc-debugger",
53+
"repository_id": "487920697",
54+
"repository_owner": "github",
55+
"repository_owner_id": "9919",
56+
"repository_visibility": "public",
57+
"run_attempt": "1",
58+
"run_id": "16055869479",
59+
"run_number": "33",
60+
"runner_environment": "github-hosted",
61+
"sha": "7f93a73b8273af5d35fcd70661704c1cadc57054",
62+
"sub": "repo:github/actions-oidc-debugger:pull_request",
63+
"workflow": "Test Debugger Action",
64+
"workflow_ref": "github/actions-oidc-debugger/.github/workflows/action-test.yml@refs/pull/27/merge",
65+
"workflow_sha": "7f93a73b8273af5d35fcd70661704c1cadc57054"
66+
}
67+
```
68+
69+
## Maintainers
70+
71+
Here is the general flow for developing this Action and releasing a new version:
72+
73+
### Bootstrapping
74+
75+
This assumes you have `goenv` installed and the version listed in the `.go-version` file is installed as well.
76+
77+
```bash
78+
go mod vendor && go mod tidy && go mod verify
79+
```
80+
81+
### Releasing
82+
83+
Please run `script/release` and publish a new release on GitHub from the resulting tag.

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: 'OIDC Debugger'
22
description: 'Print the GitHub Actions OIDC claims.'
3+
branding:
4+
icon: 'activity'
5+
color: 'red'
36
inputs:
47
audience:
58
description: 'The audience to use when requesting the JWT. Your Github server URL and repository owner (e.g. https://github.com/github).'

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/github/actions-oidc-debugger
22

3-
go 1.18
3+
go 1.24
44

55
require github.com/golang-jwt/jwt/v5 v5.2.2

script/release

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# Usage:
4+
# script/release
5+
6+
# COLORS
7+
OFF='\033[0m'
8+
RED='\033[0;31m'
9+
GREEN='\033[0;32m'
10+
BLUE='\033[0;34m'
11+
12+
latest_tag=$(git describe --tags $(git rev-list --tags --max-count=1))
13+
echo -e "The latest release tag is: ${BLUE}${latest_tag}${OFF}"
14+
read -p 'New Release Tag (vX.X.X format): ' new_tag
15+
16+
# Updated regex to allow one or more digits in each segment
17+
tag_regex='^v[0-9]+\.[0-9]+\.[0-9]+$'
18+
echo "$new_tag" | grep -E -q $tag_regex
19+
20+
if [[ $? -ne 0 ]]; then
21+
echo -e "${RED}ERROR${OFF} - Tag: $new_tag is not valid. Please use vX.X.X format."
22+
exit 1
23+
fi
24+
25+
git tag -a $new_tag -m "$new_tag Release"
26+
27+
echo -e "${GREEN}OK${OFF} - Tagged: $new_tag"
28+
29+
git push --tags
30+
31+
echo -e "${GREEN}OK${OFF} - Tags pushed to remote!"
32+
echo -e "${GREEN}DONE${OFF}"

0 commit comments

Comments
 (0)