Skip to content

Commit

Permalink
apply this change
Browse files Browse the repository at this point in the history
  • Loading branch information
tnyo43 committed Mar 5, 2024
1 parent 27ee641 commit fd96f2f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
12 changes: 0 additions & 12 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,9 @@ jobs:
id: checkout
uses: actions/checkout@v4

- name: Get PR_NUMBER for issue_comment triggered events
id: get-pr-number
if: github.event.issue.pull_request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_URL="${{ github.event.issue.pull_request.url }}"
PR_NUM=${PR_URL##*/}
echo "pr-number=$PR_NUM" >> "$GITHUB_OUTPUT"
- name: Test Local Action
id: test-action
uses: ./
with:
pr_number: ${{ steps.get-pr-number.outputs.pr-number }}

- name: Print Output
id: output
Expand Down
10 changes: 2 additions & 8 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as core from '@actions/core'
import { getOctokit, context } from '@actions/github'
import { getOption } from './option'

const uniqueStringArray = (texts: string[]): string[] => {
if (texts.length === 0) return []
Expand All @@ -22,15 +23,8 @@ const uniqueStringArray = (texts: string[]): string[] => {
*/
export async function run(): Promise<void> {
try {
const prNumber =
context.payload.pull_request?.number ||
Number(core.getInput('pr_number', { required: false }))
if (isNaN(prNumber) || prNumber === 0) {
core.setFailed('pr number is not set properly')
return
}
const { token, prNumber } = getOption()

const token = core.getInput('github_token', { required: true })
const octokit = getOctokit(token)
const owner = context.repo.owner
const repo = context.repo.repo
Expand Down

0 comments on commit fd96f2f

Please sign in to comment.