From 6e48cd721f360ee75b203497353cc09a1adc2396 Mon Sep 17 00:00:00 2001 From: Sean Budd Date: Thu, 8 Aug 2024 12:25:53 +1000 Subject: [PATCH] Set up assign milestone to use base environment variables, not branch origin --- .github/workflows/assign-milestone-on-close.yml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/.github/workflows/assign-milestone-on-close.yml b/.github/workflows/assign-milestone-on-close.yml index a849caad70f..3d835f5530d 100644 --- a/.github/workflows/assign-milestone-on-close.yml +++ b/.github/workflows/assign-milestone-on-close.yml @@ -6,9 +6,13 @@ env: on: issues: types: [closed] - pull_request: + pull_request_target: types: [closed] +permissions: + issues: write + pull-requests: write + jobs: assign-milestone: runs-on: ubuntu-latest @@ -19,7 +23,7 @@ jobs: with: github-token: ${{secrets.GITHUB_TOKEN}} script: | - const issueOrPr = context.payload.issue || context.payload.pull_request; + const issueOrPr = context.payload.issue || context.payload.pull_request_target; if (!issueOrPr.milestone) { core.setOutput('milestoneNotSet', 'true'); } else { @@ -32,7 +36,7 @@ jobs: with: github-token: ${{secrets.GITHUB_TOKEN}} script: | - const issueOrPrNumber = (context.payload.issue || context.payload.pull_request).number; + const issueOrPrNumber = (context.payload.issue || context.payload.pull_request_target).number; const repository = context.repo; await github.rest.issues.update({ ...repository,