Skip to content

Commit 6d41e9f

Browse files
authored
fix: add secret/token to major-version-updater (#57)
- [x] add docs - [x] add link to docs from README - [x] fix tag name argument from underscore to hyphen - [x] use github token in right places (GITHUB_TOKEN or arg) Signed-off-by: jmeridth <[email protected]>
1 parent 6f158f2 commit 6d41e9f

File tree

6 files changed

+34
-7
lines changed

6 files changed

+34
-7
lines changed

.github/workflows/major-version-updater.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,12 @@ name: "Major Version Updater"
33
on:
44
workflow_call:
55
inputs:
6-
tag_name:
6+
tag-name:
77
required: true
88
type: string
9+
secrets:
10+
github-token:
11+
required: true
912
permissions:
1013
contents: read
1114
jobs:
@@ -17,17 +20,19 @@ jobs:
1720
- uses: actions/[email protected]
1821
with:
1922
fetch-tags: true
20-
ref: ${{ inputs.tag_name }}
23+
ref: ${{ inputs.tag-name }}
2124
- name: version
2225
id: version
2326
env:
24-
TAG_NAME: ${{ inputs.tag_name }}
27+
TAG_NAME: ${{ inputs.tag-name }}
2528
run: |
2629
tag=${TAG_NAME/refs\/tags\//}
2730
version=${tag#v}
2831
major=${version%%.*}
2932
{ echo "tag=${tag}"; echo "version=${version}"; echo "major=${major}"; } >> "$GITHUB_OUTPUT"
3033
- name: force update major tag
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.github-token }}
3136
run: |
3237
git tag -f v${{ steps.version.outputs.major }} ${{ steps.version.outputs.tag }}
3338
git push -f origin v${{ steps.version.outputs.major }}

.github/workflows/release-discussion.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,9 @@ jobs:
3838
exit 1
3939
- name: Create an Announcement Discussion for Release
4040
uses: abirismyname/create-discussion@c2b7c825241769dda523865ae444a879f6bbd0e0
41-
env:
42-
GH_TOKEN: ${{ secrets.github-token }}
4341
with:
4442
title: ${{ inputs.full-tag }}
4543
body: ${{ inputs.body }}
4644
repository-id: ${{ env.DISCUSSION_REPOSITORY_ID }}
4745
category-id: ${{ env.DISCUSSION_CATEGORY_ID }}
46+
github-token: ${{ secrets.github-token }}

.github/workflows/release-image.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,4 @@ jobs:
6969
subject-name: ${{ env.IMAGE_REGISTRY }}/${{ inputs.image-name}}
7070
subject-digest: ${{ steps.push.outputs.digest }}
7171
push-to-registry: true
72+
github-token: ${{ secrets.github-token }}

.github/workflows/test-major-version-updater.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ jobs:
1616
contents: write
1717
uses: ./.github/workflows/major-version-updater.yaml
1818
with:
19-
tag_name: ${{ github.event.inputs.TAG_NAME || github.ref}}
19+
tag-name: ${{ github.event.inputs.TAG_NAME || github.ref}}
20+
secrets:
21+
github-token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ This is a placeholder repo for multiple GitHub Actions we use in open source pro
44

55
## Reusable Workflows Available
66

7-
- [Labeler](docs/labeler.md)
87
- [Auto-Labeler](docs/auto-labeler.md)
8+
- [Labeler](docs/labeler.md)
9+
- [Major Version Updater](docs/major-version-updater.md)
910
- [PR Title](docs/pr-title.md)
1011
- [Release](docs/release.md)
1112
- [Release Image](docs/release-image.md)

docs/major-version-updater.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Major Version Updater
2+
3+
## Inputs
4+
5+
```yaml
6+
- uses: github/ospo-reusable-workflows/.github/workflows/major-version-updater.yml@main
7+
permissions:
8+
contents: write
9+
with:
10+
# Tag name that the major tag will point to (e.g. v1.2.3)
11+
tag-name: v1.2.3
12+
secrets:
13+
# The GitHub token to use
14+
github-token: ${{ secrets.GITHUB_TOKEN }}
15+
```
16+
17+
## Outputs
18+
19+
None

0 commit comments

Comments
 (0)