Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .github/workflows/kanban.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Engineering Kanban (shared)

on:
workflow_call:
inputs:
issue_url:
description: URL of the issue to add (empty string if not an issue event)
type: string
default: ''
pr_url:
description: URL of the PR to add (empty string if not a PR event)
type: string
default: ''

permissions:
contents: read

jobs:
add-to-project:
runs-on: ubuntu-latest
steps:
- name: Generate project app token
id: app-token
uses: actions/create-github-app-token@v2
with:
app-id: ${{ secrets.PROJECT_APP_ID }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because this is a reusable workflow_call, these app secrets should either be declared under on.workflow_call.secrets as required inputs or every caller must use secrets: inherit. Named secret passing fails unless the called workflow declares the secret names, so making the secret contract explicit would make the thin caller workflows less fragile.

private-key: ${{ secrets.PROJECT_APP_PRIVATE_KEY }}
owner: zitadel

- name: Add issue to kanban
if: inputs.issue_url != ''
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
ITEM_ID=$(gh project item-add 15 --owner zitadel \
--url "${{ inputs.issue_url }}" --format json | jq -r '.id')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These workflow inputs are interpolated directly into a shell script. The current intended values are GitHub-generated URLs, but reusable workflow inputs are still a sharp edge if a future caller passes anything user-controlled. Safer pattern: assign the expression to an environment variable, then use --url "$ISSUE_URL" here and the same pattern for pr_url below.

gh project item-edit \
--project-id "PVT_kwDOBCxI8c4Bbg8_" \
--id "$ITEM_ID" \
--field-id "PVTSSF_lADOBCxI8c4Bbg8_zhWQ9SY" \
--single-select-option-id "2cd48e0f"

- name: Add PR to kanban
if: inputs.pr_url != ''

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR description says the shared workflow adds “community PRs” and that all logic lives here, but this condition accepts any PR URL the caller passes. If thin caller workflows pass github.event.pull_request.html_url on pull_request_target.opened, internal PRs will be added too. Can we move the existing dependabot/staff/engineer filtering into this shared workflow, or make the caller contract explicit that callers must only pass community PR URLs?

env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
ITEM_ID=$(gh project item-add 15 --owner zitadel \
--url "${{ inputs.pr_url }}" --format json | jq -r '.id')
gh project item-edit \
--project-id "PVT_kwDOBCxI8c4Bbg8_" \
--id "$ITEM_ID" \
--field-id "PVTSSF_lADOBCxI8c4Bbg8_zhWQ9SY" \
--single-select-option-id "2cd48e0f"