| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| name: Dev PR |
| |
| on: |
| pull_request_target: |
| types: |
| - labeled |
| - unlabeled |
| - opened |
| - edited |
| - reopened |
| - synchronize |
| - ready_for_review |
| - review_requested |
| |
| concurrency: |
| group: ${{ github.repository }}-${{ github.ref }}-${{ github.workflow }} |
| cancel-in-progress: true |
| |
| permissions: |
| contents: read |
| issues: write |
| pull-requests: write |
| |
| jobs: |
| pr-label: |
| name: "Ensure PR format" |
| runs-on: ubuntu-latest |
| steps: |
| - uses: actions/checkout@v6 |
| with: |
| fetch-depth: 0 |
| persist-credentials: false |
| |
| - name: Ensure PR title format |
| id: title-format |
| uses: actions/github-script@v8 |
| with: |
| script: | |
| const scripts = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/dev_pr.js`); |
| return scripts.check_title_format({core, github, context}); |
| |
| - name: Label PR |
| uses: actions/github-script@v8 |
| with: |
| script: | |
| const scripts = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/dev_pr.js`); |
| await scripts.apply_labels({core, github, context}); |
| |
| - name: Ensure PR is labeled |
| uses: actions/github-script@v8 |
| with: |
| script: | |
| const scripts = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/dev_pr.js`); |
| await scripts.check_labels({core, github, context}); |
| |
| - name: Ensure PR is linked to an issue |
| uses: actions/github-script@v8 |
| with: |
| script: | |
| const scripts = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/dev_pr.js`); |
| await scripts.check_linked_issue({core, github, context, issue: ${{ steps.title-format.outputs.result }}}); |
| |
| - name: Assign milestone |
| if: '! github.event.pull_request.draft' |
| env: |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| run: | |
| ./.github/workflows/dev_pr_milestone.sh "${GITHUB_REPOSITORY}" ${{ github.event.number }} |