Skip to content

Commit aa1c62d

Browse files
committed
chore(ci): Give requireReleseLabel access to github token
1 parent b9b6f2e commit aa1c62d

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed
Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
name: 'Require Release Label Conditional'
22
description: 'Require release labels on PRs unless title starts with conventional commit prefixes'
3+
4+
inputs:
5+
github-token:
6+
description: 'GitHub token for setting milestones'
7+
required: false
8+
default: ''
9+
310
runs:
4-
using: 'node20'
11+
using: 'node24'
512
main: 'requireReleaseLabelOrCcMessage.mjs'

.github/actions/require-release-label-or-cc-message/requireReleaseLabelOrCcMessage.mjs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ const env = {
3232
* @see https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables.
3333
*/
3434
GITHUB_EVENT_PATH: process.env.GITHUB_EVENT_PATH || '',
35-
/** `GITHUB_TOKEN` - GitHub token for API requests */
36-
GITHUB_TOKEN: process.env.GITHUB_TOKEN || '',
35+
/**
36+
* `GITHUB_TOKEN` - GitHub token for API requests
37+
* From github-token input, which gets prefixed by `INPUT_` and made available
38+
* as an environment variable.
39+
* @see https://docs.github.com/en/actions/reference/workflows-and-actions/metadata-syntax#example-specifying-inputs
40+
*/
41+
GITHUB_TOKEN: process.env['INPUT_GITHUB-TOKEN'] || '',
3742
/** `GITHUB_REPOSITORY` - The owner and repository name */
3843
GITHUB_REPOSITORY: process.env.GITHUB_REPOSITORY || '',
3944
}
@@ -78,8 +83,6 @@ async function main() {
7883

7984
const { title, labels } = await prResponse.json()
8085

81-
console.log('pr data from fetch request', { title, labels })
82-
8386
// Check if the PR title starts with conventional commit prefixes that should
8487
// skip label requirement
8588
const conventionalCommitPrefixes = [

.github/workflows/require-release-label.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ jobs:
2929

3030
- name: ✅ Check release label requirement
3131
uses: ./.github/actions/require-release-label-or-cc-message
32+
with:
33+
github-token: ${{ secrets.GITHUB_TOKEN }}

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ export default [
447447
'packages/project-config/src/envVarDefinitions.ts',
448448
'packages/testing/**',
449449
'packages/vite/src/plugins/vite-plugin-cedar-html-env.ts',
450+
'.github/**',
450451
],
451452
rules: {
452453
'@cedarjs/process-env-computed': 'off',

0 commit comments

Comments
 (0)