Skip to content

Commit 2624889

Browse files
authored
Remove github_token input, correct for SBOM file placement (#1391)
* Remove github_token input Inputs need to be literal, static values. Instead we should simply use `${{ secrets.GITHUB_TOKEN }}` which is resolved at runtime * Copy over generated SBOM files The SBOM generator currently outputs the files at the workspace root.
1 parent e365da1 commit 2624889

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

.github/workflows/auto-release.yml

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ on:
1515
description: "Version String for task.h on main branch (leave empty to leave as-is)."
1616
required: false
1717
default: ''
18-
github_token:
19-
description: 'GitHub token for creating releases and pushing changes'
20-
required: false
21-
default: ${{ github.token }}
2218

2319
jobs:
2420
release-packager:
@@ -35,7 +31,7 @@ jobs:
3531
with:
3632
architecture: x64
3733
env:
38-
GITHUB_TOKEN: ${{ github.event.inputs.github_token }}
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3935

4036
- name: Install GitHub CLI
4137
run: |
@@ -90,7 +86,7 @@ jobs:
9086
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
9187
MAIN_BR_VERSION_NUMBER: ${{ github.event.inputs.main_br_version }}
9288
COMMIT_SHA_1: ${{ env.COMMIT_SHA_1 }}
93-
GITHUB_TOKEN: ${{ github.event.inputs.github_token }}
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9490
run: |
9591
# Install deps and run
9692
pip install -r ./tools/.github/scripts/release-requirements.txt
@@ -126,7 +122,7 @@ jobs:
126122
- name: Create pull request
127123
env:
128124
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
129-
GH_TOKEN: ${{ github.event.inputs.github_token }}
125+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130126
REPO_FULL_NAME: ${{ github.repository }}
131127
working-directory: ./local_kernel
132128
run: |
@@ -140,7 +136,7 @@ jobs:
140136
141137
- name: Wait for PR to be merged
142138
env:
143-
GH_TOKEN: ${{ github.event.inputs.github_token }}
139+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
144140
REPO_FULL_NAME: ${{ github.repository }}
145141
working-directory: ./local_kernel
146142
run: |
@@ -179,12 +175,18 @@ jobs:
179175
- name: Commit SBOM file
180176
env:
181177
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
182-
GITHUB_TOKEN: ${{ github.event.inputs.github_token }}
183-
working-directory: ./local_kernel
178+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
184179
run: |
180+
# SBOM generator writes files to the workspace root — copy them into the repo
181+
cp *SPDX* ./local_kernel/ 2>/dev/null || cp *spdx* ./local_kernel/ 2>/dev/null || true
182+
cd ./local_kernel
185183
git add .
186-
git commit -m '[AUTO][RELEASE]: Update SBOM'
187-
git push -u origin "$VERSION_NUMBER"
184+
if git diff --cached --quiet; then
185+
echo "No SBOM changes to commit."
186+
else
187+
git commit -m '[AUTO][RELEASE]: Update SBOM'
188+
git push -u origin "$VERSION_NUMBER"
189+
fi
188190
echo "COMMIT_SHA_2=$(git rev-parse HEAD)" >> $GITHUB_ENV
189191
190192
- name: Release
@@ -193,7 +195,7 @@ jobs:
193195
MAIN_BR_VERSION_NUMBER: ${{ github.event.inputs.main_br_version }}
194196
COMMIT_SHA_2: ${{ env.COMMIT_SHA_2 }}
195197
REPO_OWNER: ${{ github.repository_owner }}
196-
GITHUB_TOKEN: ${{ github.event.inputs.github_token }}
198+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
197199
run: |
198200
# Install deps and run
199201
pip install -r ./tools/.github/scripts/release-requirements.txt
@@ -212,7 +214,7 @@ jobs:
212214
if: always()
213215
env:
214216
VERSION_NUMBER: ${{ github.event.inputs.version_number }}
215-
GH_TOKEN: ${{ github.event.inputs.github_token }}
217+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
216218
working-directory: ./local_kernel
217219
run: |
218220
# Only delete release-prep branch if the PR was already merged

0 commit comments

Comments
 (0)