diff --git a/.github/workflows/pr-automation.yml b/.github/workflows/pr-automation.yml index 20d9f01ea..78573189e 100644 --- a/.github/workflows/pr-automation.yml +++ b/.github/workflows/pr-automation.yml @@ -12,6 +12,8 @@ on: workflow_run: # To react to the result of a workflow on a pull request workflows: ["Code coverage", "RTLMeter", "Regression"] types: [completed] + push: # A pull request can start conflicting when its base branch moves + branches: [master] permissions: contents: read # To check out the local action, everything else uses the CI app token @@ -81,6 +83,33 @@ jobs: --remove-label "${LABELS}" fi + conflicting: + name: Conflict check + # A pull request can start conflicting when its own head moves, or when the + # base branch moves under it, so sweep the open pull requests on both. + if: | + github.repository == 'verilator/verilator' + && (github.event_name == 'push' + || (github.event_name == 'pull_request_target' + && github.event.action == 'synchronize')) + runs-on: ubuntu-slim + steps: + # Label as the CI app, and not with 'github.token', as events from the + # latter do not create workflow runs, so the labels would drive nothing + - name: Generate access token + id: generate-token + uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + with: + client-id: ${{ vars.VERILATOR_CI_ID }} + private-key: ${{ secrets.VERILATOR_CI_KEY }} + permission-pull-requests: write + + - name: "Update the 'pr-blocked: needs-rebase' label" + uses: eps1lon/actions-label-merge-conflict@0273be72a0bbd58fcd71d0d6c02c209b50d1e5e1 # 3.1.0 + with: + dirtyLabel: "pr-blocked: needs-rebase" + repoToken: ${{ steps.generate-token.outputs.token }} + regression-complete: name: Regression complete if: | diff --git a/.github/workflows/pr-conflicting.yml b/.github/workflows/pr-conflicting.yml deleted file mode 100644 index b644d1524..000000000 --- a/.github/workflows/pr-conflicting.yml +++ /dev/null @@ -1,28 +0,0 @@ ---- -# Build and push verilator docker image when tags are pushed to the repository. -# The following variable(s) must be configured in the github repository: -# DOCKER_HUB_NAMESPACE: docker hub namespace. -# The following secrets must be configured in the github repository: -# DOCKER_HUB_USER: user name for logging into docker hub -# DOCKER_HUB_ACCESS_TOKEN: docker hub access token. -name: Maintainance - PR conflict check - -on: - workflow_dispatch: - push: - pull_request_target: - types: [synchronize] -permissions: {} - -jobs: - main: - runs-on: ubuntu-26.04 - permissions: - contents: read - pull-requests: write - steps: - - name: check if prs are dirty - uses: eps1lon/actions-label-merge-conflict@0273be72a0bbd58fcd71d0d6c02c209b50d1e5e1 # 3.1.0 - with: - dirtyLabel: "pr-blocked: needs-rebase" - repoToken: "${{ secrets.GITHUB_TOKEN }}"