Flag/Unflag pull requests #215
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Copyright 2025 The Flutter Authors. | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| # This automation adds/removes the 'status: needs-triage' label to pull requests | |
| # so that PRs needing attention are easy to find. The label is fully owned by | |
| # this automation and reconciled on every run. | |
| # | |
| # The flagging rules live in ./tool/triage.mjs — see the header comment there | |
| # for the full specification: | |
| # https://github.com/flutter/genui/blob/main/tool/triage.mjs | |
| # | |
| # For the history of runs, see: | |
| # https://github.com/flutter/genui/actions/workflows/triage.yaml | |
| name: Flag/Unflag pull requests | |
| on: | |
| # Periodic reconciliation: catches time-based rules (staleness) and removes the | |
| # label once a PR no longer matches. | |
| schedule: | |
| - cron: "0 15 * * *" # daily at 15:00 UTC | |
| # React promptly to the events that can change a PR's flag state. | |
| # Ignored since pull_request_target is used safely here (checks out main branch to run triage script). | |
| pull_request_target: # zizmor: ignore[dangerous-triggers] | |
| types: [opened, edited, reopened, ready_for_review, synchronize] | |
| issue_comment: | |
| types: [created] | |
| pull_request_review: | |
| types: [submitted] | |
| pull_request_review_comment: | |
| types: [created] | |
| # Allow manual runs from the Actions tab. | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| jobs: | |
| triage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| persist-credentials: false | |
| - name: Reconcile triage flag labels | |
| uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7 | |
| with: | |
| script: | | |
| const path = require('path'); | |
| const { pathToFileURL } = require('url'); | |
| const filePath = path.resolve('./tool/triage.mjs'); | |
| const fileUrl = pathToFileURL(filePath).href; | |
| const importedModule = await import(fileUrl); | |
| await importedModule.default({ github, context }); |