Repository navigation
fullsend Jira poll #725
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
| # Poll RHIDP for Fullsend commands intended for this repository. | |
| # | |
| # Fullsend resolves the command author's Jira role in RHIDP. | |
| # Only /fs-triage and /fs-code are registered for | |
| # Jira dispatch; other Fullsend commands remain out of scope. | |
| name: fullsend Jira poll | |
| on: | |
| schedule: | |
| - cron: "*/5 * * * *" | |
| workflow_dispatch: {} | |
| permissions: {} | |
| jobs: | |
| poll: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: fullsend-jira-poll | |
| cancel-in-progress: false | |
| outputs: | |
| matrix: ${{ steps.build-matrix.outputs.matrix }} | |
| has_dispatches: ${{ steps.build-matrix.outputs.has_dispatches }} | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1 | |
| with: | |
| egress-policy: audit | |
| - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | |
| - name: Install fullsend | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| set -euo pipefail | |
| gh release download v0.43.0 --repo fullsend-ai/fullsend \ | |
| -p 'fullsend_0.43.0_linux_amd64.tar.gz' -O - | tar xz | |
| sudo mv fullsend /usr/local/bin/ | |
| fullsend --version | |
| - name: Poll Jira | |
| env: | |
| JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }} | |
| JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} | |
| JIRA_BASE_URL: ${{ vars.JIRA_BASE_URL }} | |
| TARGET_REPO: ${{ github.repository }} | |
| run: | | |
| set -euo pipefail | |
| if [[ -z "${JIRA_BASE_URL}" ]]; then | |
| echo "::error::JIRA_BASE_URL variable is empty (must be an Actions variable, not a secret)" | |
| exit 1 | |
| fi | |
| if [[ -z "${JIRA_TOKEN}" || -z "${JIRA_USER_EMAIL}" ]]; then | |
| echo "::error::JIRA_TOKEN and JIRA_USER_EMAIL must be configured as Actions secrets" | |
| exit 1 | |
| fi | |
| poll_project() { | |
| local project="$1" | |
| local team_id="$2" | |
| local output="dispatches-${project,,}.json" | |
| # Keep each gate explicit. To enroll another team/project, add one | |
| # poll_project call below with its Atlassian team ID. | |
| local jql="project = ${project} AND cf[10001] = \"${team_id}\" AND labels = \"fullsend\" AND statusCategory != Done AND updated >= \"-12h\" ORDER BY updated DESC" | |
| echo "Polling ${project} for team ${team_id}; dispatching matches to ${TARGET_REPO}" | |
| fullsend poll \ | |
| --input-driver jira-poll \ | |
| --mode slash \ | |
| --jira-url "${JIRA_BASE_URL}" \ | |
| --jira-project "${project}" \ | |
| --jql "${jql}" \ | |
| --target-repo "${TARGET_REPO}" \ | |
| --output "${output}" \ | |
| --fullsend-dir .fullsend | |
| } | |
| # Jira Team "RHDH AI" uses this Atlassian ID in cf[10001], not its display name. | |
| RHDH_AI_TEAM_ID='ec74d716-af36-4b3c-950f-f79213d08f71-1087' | |
| poll_project RHIDP "${RHDH_AI_TEAM_ID}" | |
| jq -s 'add' dispatches-*.json > dispatches.json | |
| echo "Dispatch count: $(jq 'length' dispatches.json)" | |
| jq -c '.[] | {agent, event_type, status_number}' dispatches.json || true | |
| - name: Upload dispatches.json | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 | |
| if: always() | |
| with: | |
| name: dispatches | |
| path: dispatches.json | |
| if-no-files-found: ignore | |
| - name: Build dispatch matrix | |
| id: build-matrix | |
| run: | | |
| set -euo pipefail | |
| if [[ ! -f dispatches.json ]] || ! jq -e 'length > 0' dispatches.json > /dev/null 2>&1; then | |
| echo "No dispatches." | |
| echo 'matrix={"include":[]}' >> "${GITHUB_OUTPUT}" | |
| echo "has_dispatches=false" >> "${GITHUB_OUTPUT}" | |
| exit 0 | |
| fi | |
| MATRIX=$(jq -c '{include: .}' dispatches.json) | |
| DELIM="MATRIX_$(openssl rand -hex 8)" | |
| { | |
| echo "matrix<<${DELIM}" | |
| printf '%s' "${MATRIX}" | |
| echo | |
| echo "${DELIM}" | |
| } >> "${GITHUB_OUTPUT}" | |
| echo "has_dispatches=true" >> "${GITHUB_OUTPUT}" | |
| harness: | |
| name: Harness | |
| needs: poll | |
| if: needs.poll.outputs.has_dispatches == 'true' | |
| permissions: | |
| actions: write | |
| contents: write | |
| id-token: write | |
| issues: write | |
| packages: read | |
| pull-requests: write | |
| uses: fullsend-ai/fullsend/.github/workflows/reusable-dispatch.yml@3454a2e4ee2b667e2ed71fa9d384edc6de3d4f74 # v0.45.0 | |
| with: | |
| matrix: ${{ needs.poll.outputs.matrix }} | |
| install_mode: per-repo | |
| mint_url: ${{ vars.FULLSEND_MINT_URL }} | |
| gcp_region: ${{ vars.FULLSEND_GCP_REGION }} | |
| jira_base_url: ${{ vars.JIRA_BASE_URL }} | |
| runner_image: ubuntu-24.04 | |
| secrets: | |
| FULLSEND_GCP_WIF_PROVIDER: ${{ secrets.FULLSEND_GCP_WIF_PROVIDER }} | |
| FULLSEND_GCP_PROJECT_ID: ${{ secrets.FULLSEND_GCP_PROJECT_ID }} | |
| OTEL_EXPORTER_OTLP_TRACES_HEADERS: ${{ secrets.OTEL_EXPORTER_OTLP_TRACES_HEADERS }} | |
| OTEL_EXPORTER_OTLP_HEADERS: ${{ secrets.OTEL_EXPORTER_OTLP_HEADERS }} | |
| JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }} | |
| JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} |