Skip to content
Latchkey

Add PR to project board workflow (open-telemetry/opentelemetry-python)

The Add PR to project board workflow from open-telemetry/opentelemetry-python, explained and optimized by Latchkey.

A

CI health: A - excellent

Point runs-on at Latchkey and get job timeouts, self-healing for flaky steps, and up to 58% lower cost, applied automatically.

Grade your own workflow free or run it on Latchkey →
Source: open-telemetry/opentelemetry-python.github/workflows/add-to-project.ymlLicense Apache-2.0View source

What it does

This is the Add PR to project board workflow from the open-telemetry/opentelemetry-python repository, a real project running GitHub Actions. It is shown here with attribution under its Apache-2.0 license.

Below, Latchkey shows a faster, safer version produced by its optimization engine.

The workflow

workflow (.yml)
name: Add PR to project board

on:
  pull_request_target:
    types: [opened, reopened, ready_for_review]

permissions:
  contents: read

jobs:
  add-to-project:
    name: add to project board
    runs-on: ubuntu-latest
    if: github.event.pull_request.draft == false
    steps:
      # NOTE: do NOT add an actions/checkout step here. This workflow uses
      # pull_request_target (which has access to secrets) but must never
      # execute code from the fork branch. See PR #4955 for context.
      - uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
        id: otelbot-token
        with:
          app-id: ${{ vars.OTELBOT_PYTHON_APP_ID }}
          private-key: ${{ secrets.OTELBOT_PYTHON_PRIVATE_KEY }}

      - uses: actions/add-to-project@v1.0.2
        with:
          project-url: https://github.com/orgs/open-telemetry/projects/88
          github-token: ${{ steps.otelbot-token.outputs.token }}

The same workflow, on Latchkey

Removes redundant runs and caps runaway jobs. Added and changed lines are highlighted.

name: Add PR to project board
 
on:
  pull_request_target:
    types: [opened, reopened, ready_for_review]
 
permissions:
  contents: read
 
jobs:
  add-to-project:
    timeout-minutes: 30
    name: add to project board
    runs-on: latchkey-small
    if: github.event.pull_request.draft == false
    steps:
      # NOTE: do NOT add an actions/checkout step here. This workflow uses
      # pull_request_target (which has access to secrets) but must never
      # execute code from the fork branch. See PR #4955 for context.
      - uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6
        id: otelbot-token
        with:
          app-id: ${{ vars.OTELBOT_PYTHON_APP_ID }}
          private-key: ${{ secrets.OTELBOT_PYTHON_PRIVATE_KEY }}
 
      - uses: actions/add-to-project@v1.0.2
        with:
          project-url: https://github.com/orgs/open-telemetry/projects/88
          github-token: ${{ steps.otelbot-token.outputs.token }}
 

What changed

This workflow runs 1 job per trigger. On Latchkey the same minutes cost up to 58% less than GitHub-hosted, with zero queue time.

Actions used in this workflow