|
| 1 | +# The Playwright bot runs in microsoft/devops.playwright.dev. This workflow hands it the request |
| 2 | +# when a maintainer applies a label: agent-triage, agent-implement or agent-task on an issue starts |
| 3 | +# issue.yml there, and agent-review on a pull request starts pr.yml. Nothing else of the bot lives |
| 4 | +# in this repo. Apply the label again to start another run. |
| 5 | +# |
| 6 | +# The same file is in every Playwright repo, as .github/workflows/bots.yml. Its source is |
| 7 | +# bots/shim.yml in microsoft/devops.playwright.dev, and README.md there describes the flows. |
| 8 | +name: Bots |
| 9 | + |
| 10 | +on: |
| 11 | + issues: |
| 12 | + types: [labeled] |
| 13 | + # Runs from the default branch, for PRs from forks too. It never checks out the PR. |
| 14 | + pull_request_target: |
| 15 | + types: [labeled] |
| 16 | + |
| 17 | +permissions: {} |
| 18 | + |
| 19 | +jobs: |
| 20 | + issue: |
| 21 | + name: Hand the issue to the bot |
| 22 | + if: >- |
| 23 | + github.repository_owner == 'microsoft' && github.event_name == 'issues' && ( |
| 24 | + github.event.label.name == 'agent-triage' || |
| 25 | + github.event.label.name == 'agent-implement' || |
| 26 | + github.event.label.name == 'agent-task') |
| 27 | + runs-on: ubuntu-latest |
| 28 | + timeout-minutes: 5 |
| 29 | + steps: |
| 30 | + - uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 |
| 31 | + id: app-token |
| 32 | + with: |
| 33 | + client-id: ${{ vars.PLAYWRIGHT_APP_CLIENT_ID }} |
| 34 | + private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }} |
| 35 | + owner: microsoft |
| 36 | + repositories: devops.playwright.dev |
| 37 | + permission-actions: write |
| 38 | + - name: Start issue.yml in microsoft/devops.playwright.dev |
| 39 | + env: |
| 40 | + GH_TOKEN: ${{ steps.app-token.outputs.token }} |
| 41 | + NUMBER: ${{ github.event.issue.number }} |
| 42 | + LABEL: ${{ github.event.label.name }} |
| 43 | + run: >- |
| 44 | + gh workflow run issue.yml --repo microsoft/devops.playwright.dev --ref main |
| 45 | + -f repo="$GITHUB_REPOSITORY" -f issue="$NUMBER" -f label="$LABEL" |
| 46 | +
|
| 47 | + pr: |
| 48 | + name: Hand the PR to the bot |
| 49 | + if: >- |
| 50 | + github.repository_owner == 'microsoft' && github.event_name == 'pull_request_target' && |
| 51 | + github.event.label.name == 'agent-review' |
| 52 | + runs-on: ubuntu-latest |
| 53 | + timeout-minutes: 5 |
| 54 | + steps: |
| 55 | + - uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 |
| 56 | + id: app-token |
| 57 | + with: |
| 58 | + client-id: ${{ vars.PLAYWRIGHT_APP_CLIENT_ID }} |
| 59 | + private-key: ${{ secrets.PLAYWRIGHT_PRIVATE_KEY }} |
| 60 | + owner: microsoft |
| 61 | + repositories: devops.playwright.dev |
| 62 | + permission-actions: write |
| 63 | + - name: Start pr.yml in microsoft/devops.playwright.dev |
| 64 | + env: |
| 65 | + GH_TOKEN: ${{ steps.app-token.outputs.token }} |
| 66 | + NUMBER: ${{ github.event.pull_request.number }} |
| 67 | + run: >- |
| 68 | + gh workflow run pr.yml --repo microsoft/devops.playwright.dev --ref main |
| 69 | + -f repo="$GITHUB_REPOSITORY" -f pr="$NUMBER" |
0 commit comments