diff --git a/.github/actions/assign-issue/action.yml b/.github/actions/issue-label-assign/action.yml similarity index 100% rename from .github/actions/assign-issue/action.yml rename to .github/actions/issue-label-assign/action.yml diff --git a/.github/actions/assign-issue/index.js b/.github/actions/issue-label-assign/index.js similarity index 100% rename from .github/actions/assign-issue/index.js rename to .github/actions/issue-label-assign/index.js diff --git a/.github/actions/assign-issue/index.ts b/.github/actions/issue-label-assign/index.ts similarity index 98% rename from .github/actions/assign-issue/index.ts rename to .github/actions/issue-label-assign/index.ts index 366069fe202aac9..fbb09ec24fdcbac 100644 --- a/.github/actions/assign-issue/index.ts +++ b/.github/actions/issue-label-assign/index.ts @@ -84,7 +84,7 @@ import * as codeOwnersUtils from "codeowners-utils"; console.log("Assignees added (if present)"); - // Add labels for future reporting + // Add "product" labels const labelPrefix = "product:"; const newLabels = new Set(); diff --git a/.github/actions/assign-issue/package-lock.json b/.github/actions/issue-label-assign/package-lock.json similarity index 99% rename from .github/actions/assign-issue/package-lock.json rename to .github/actions/issue-label-assign/package-lock.json index f57d26130c97058..7f394df4e0f685c 100644 --- a/.github/actions/assign-issue/package-lock.json +++ b/.github/actions/issue-label-assign/package-lock.json @@ -1,11 +1,11 @@ { - "name": "assign-issue", + "name": "issue-label-assign", "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "assign-issue", + "name": "issue-label-assign", "version": "0.0.0", "dependencies": { "codeowners-utils": "^1.0.2" diff --git a/.github/actions/assign-issue/package.json b/.github/actions/issue-label-assign/package.json similarity index 91% rename from .github/actions/assign-issue/package.json rename to .github/actions/issue-label-assign/package.json index d1f1c496baeab5b..3ff99eb8886e52a 100644 --- a/.github/actions/assign-issue/package.json +++ b/.github/actions/issue-label-assign/package.json @@ -1,7 +1,7 @@ { "private": true, "version": "0.0.0", - "name": "assign-issue", + "name": "issue-label-assign", "scripts": { "build": "esbuild index.ts --bundle --format=cjs --platform=node --minify --outfile=index.js" }, diff --git a/.github/actions/assign-issue/readme.md b/.github/actions/issue-label-assign/readme.md similarity index 100% rename from .github/actions/assign-issue/readme.md rename to .github/actions/issue-label-assign/readme.md diff --git a/.github/workflows/issue-label-assign.yml b/.github/workflows/issue-label-assign.yml new file mode 100644 index 000000000000000..c0aabf16739ed78 --- /dev/null +++ b/.github/workflows/issue-label-assign.yml @@ -0,0 +1,21 @@ +name: Issue - Label and assign + +# **What it does**: Labels Issues with associated products. Updates assignees to match our CODEOWNERS file. +# **Why we have it**: Easier scanning of repo PRs && backend reporting on our team's work. +# **Who does it impact**: PCX team + +on: + issues: + types: [opened] + +jobs: + compile: + name: Label and assign + permissions: + issues: write + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/issue-label-assign + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/issue.yml b/.github/workflows/issue.yml deleted file mode 100644 index 6d61fc4d6401bda..000000000000000 --- a/.github/workflows/issue.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: Issue Opened - -on: - issues: - types: [opened] - -jobs: - compile: - name: Assignee - permissions: - issues: write - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/assign-issue - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/label-pr.yml b/.github/workflows/pr-label-assign.yml similarity index 59% rename from .github/workflows/label-pr.yml rename to .github/workflows/pr-label-assign.yml index c8b84ee4340082d..5b3a33733be7aea 100644 --- a/.github/workflows/label-pr.yml +++ b/.github/workflows/pr-label-assign.yml @@ -1,10 +1,13 @@ -name: Label PRs +name: PR - Label and assign -# **What it does**: Uses the files to label PRs with updated doc areas && size estimates. +# **What it does**: Labels PRs with size and associated products. Updates assignees to match our CODEOWNERS file. # **Why we have it**: Easier scanning of repo PRs && backend reporting on our team's work. # **Who does it impact**: PCX team -on: [pull_request_target] +# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target +on: + pull_request_target: + types: [opened, reopened] concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} @@ -36,3 +39,16 @@ jobs: with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} continue-on-error: true + + assign: + name: Update assignees + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/checkout@v4 + - uses: ./.github/actions/assign-pr + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + continue-on-error: true diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml deleted file mode 100644 index 8f9dd9fa98cc2f0..000000000000000 --- a/.github/workflows/pr.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: PR Opened - -# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target -on: - pull_request_target: - types: [opened, reopened] - -concurrency: - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} - cancel-in-progress: true - -jobs: - compile: - name: Update assignees - runs-on: ubuntu-latest - permissions: - issues: write - pull-requests: write - steps: - - uses: actions/checkout@v4 - - uses: ./.github/actions/assign-pr - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}