Skip to content

Commit 3fc12e3

Browse files
committed
make pr_number required
1 parent d81b168 commit 3fc12e3

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

.github/workflows/style-bot-action.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ on:
1616
description: "Which style command to run (options: 'default' (make style && make quality), 'quality_only', 'style_only')"
1717
default: "default"
1818
pr_number:
19-
required: false
19+
required: true
2020
type: number
21-
description: "Pull Request number to process (only used when running manually)"
21+
description: "Pull Request number to process"
2222
python_quality_dependencies:
2323
required: true
2424
type: string
@@ -74,13 +74,13 @@ jobs:
7474
- name: Extract PR details
7575
id: pr_info
7676
uses: actions/github-script@v6
77+
env:
78+
PR_NUMBER: ${{ inputs.pr_number }}
7779
with:
7880
script: |
79-
const prNumber = context.eventName === 'workflow_dispatch'
80-
? context.payload.inputs.pr_number
81-
: context.payload.issue.number;
81+
const prNumber = process.env.PR_NUMBER;
82+
console.log(`PR number from env: "${prNumber}"`);
8283
83-
// Get PR details
8484
const { data: pr } = await github.rest.pulls.get({
8585
owner: context.repo.owner,
8686
repo: context.repo.repo,
@@ -125,11 +125,11 @@ jobs:
125125
126126
- name: Verify critical files haven't been modified
127127
uses: actions/github-script@v6
128+
env:
129+
PR_NUMBER: ${{ inputs.pr_number }}
128130
with:
129131
script: |
130-
const prNumber = context.eventName === 'workflow_dispatch'
131-
? context.payload.inputs.pr_number
132-
: context.payload.issue.number;
132+
const prNumber = process.env.PR_NUMBER;
133133
const { data: pr } = await github.rest.pulls.listFiles({
134134
owner: context.repo.owner,
135135
repo: context.repo.repo,

.github/workflows/style-bot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ jobs:
2020
with:
2121
python_quality_dependencies: "[quality]"
2222
style_command_type: "style_only"
23-
pr_number: ${{ fromJSON(inputs.pr_number || '0') }}
23+
pr_number: ${{ fromJSON(github.event_name == 'workflow_dispatch' && github.event.inputs.pr_number || github.event.issue.number) }}
2424
secrets:
2525
bot_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)