Repository navigation
ci: sync GitHub issues and PRs to Athena #1505
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| name: Run sync-athena | ||
| description: Pull gitlab.espressif.cn:5050/idf/sync-athena and run one sync mode. | ||
|
|
||
| inputs: | ||
| mode: | ||
| description: issue_to_task, comment_to_task, or pr_to_comment | ||
| required: true | ||
| issue_number: | ||
| description: Backfill issue number(s); used only for workflow_dispatch | ||
| required: false | ||
| default: "" | ||
| image: | ||
| description: sync-athena image built by the idf/sync-athena GitLab pipeline | ||
| required: false | ||
| default: gitlab.espressif.cn:5050/idf/sync-athena:latest | ||
| ticket_prefix: | ||
| description: Ticket key prefix; issue #42 becomes <prefix>-42 | ||
| required: false | ||
| default: IEP | ||
| editors: | ||
| description: Comma-separated editor emails | ||
| required: false | ||
| default: "" | ||
| co_authors: | ||
| description: Comma-separated co-author emails | ||
| required: false | ||
| default: "" | ||
| email_domain: | ||
| description: Domain used to expand bare usernames in editors/co_authors | ||
| required: false | ||
| default: espressif.com | ||
| athena_project_uuid: | ||
| description: Athena project UUID | ||
| required: true | ||
| athena_db_path: | ||
| description: Athena database path (project/proj_<uuid>.db) | ||
| required: true | ||
| athena_base_url: | ||
| description: Athena server URL | ||
| required: true | ||
| athena_token: | ||
| description: Athena bot token (nodes:read, nodes:write) | ||
| required: true | ||
| registry_username: | ||
| description: GitLab registry username | ||
| required: true | ||
| registry_token: | ||
| description: GitLab token with read_registry on idf/sync-athena | ||
| required: true | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Log in to GitLab Container Registry | ||
| uses: docker/login-action@v3 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟠 Major | ⚡ Quick win Security Misconfiguration Reachability: External Pin all external GitHub Actions to reviewed full commit SHAs. The mutable
Based on learnings: GitHub Actions must pin third-party actions to a full commit SHA. 📍 Affects 2 files
🤖 Prompt for AI Agents |
||
| with: | ||
| registry: gitlab.espressif.cn:5050 | ||
| username: ${{ inputs.registry_username }} | ||
| password: ${{ inputs.registry_token }} | ||
|
|
||
| - name: Pull sync-athena image | ||
| shell: bash | ||
| env: | ||
| IMAGE: ${{ inputs.image }} | ||
| run: docker pull "$IMAGE" | ||
|
|
||
| - name: Run sync-athena | ||
| shell: bash | ||
| env: | ||
| IMAGE: ${{ inputs.image }} | ||
| MODE: ${{ inputs.mode }} | ||
| REPO: ${{ github.repository }} | ||
| ISSUE_NUMBER: ${{ inputs.issue_number }} | ||
| EVENT_PATH: ${{ github.event_path }} | ||
| ATHENA_TICKET_PREFIX: ${{ inputs.ticket_prefix }} | ||
| ATHENA_EDITORS: ${{ inputs.editors }} | ||
| ATHENA_CO_AUTHORS: ${{ inputs.co_authors }} | ||
| ATHENA_EMAIL_DOMAIN: ${{ inputs.email_domain }} | ||
| ATHENA_PROJECT_UUID: ${{ inputs.athena_project_uuid }} | ||
| ATHENA_DB_PATH: ${{ inputs.athena_db_path }} | ||
| ATHENA_BASE_URL: ${{ inputs.athena_base_url }} | ||
| ATHENA_TOKEN: ${{ inputs.athena_token }} | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| run: | | ||
| docker run --rm \ | ||
| -v "${RUNNER_TEMP}:${RUNNER_TEMP}" \ | ||
| -v "${GITHUB_WORKSPACE}:${GITHUB_WORKSPACE}" \ | ||
| -e MODE -e REPO -e EVENT_PATH -e ISSUE_NUMBER \ | ||
| -e ATHENA_PROJECT_UUID -e ATHENA_DB_PATH -e ATHENA_BASE_URL -e ATHENA_TOKEN \ | ||
| -e ATHENA_TICKET_PREFIX -e ATHENA_EDITORS -e ATHENA_CO_AUTHORS \ | ||
| -e ATHENA_EMAIL_DOMAIN \ | ||
| -e GITHUB_TOKEN -e GITHUB_OUTPUT \ | ||
| "$IMAGE" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,93 @@ | ||
| name: 🔷 Sync to Athena | ||
|
|
||
| run-name: > | ||
| Sync to Athena - | ||
| ${{ github.event_name == 'pull_request' && 'New Pull Request' || | ||
| github.event_name == 'issue_comment' && 'New Comment' || | ||
| github.event_name == 'issues' && 'New Issue' || | ||
| github.event_name == 'workflow_dispatch' && 'Manual Sync' }} | ||
|
|
||
| on: | ||
| issues: | ||
| types: [opened, edited, reopened, closed] | ||
| issue_comment: | ||
| types: [created, edited] | ||
| pull_request: | ||
| types: [opened, reopened, ready_for_review] | ||
| workflow_dispatch: | ||
| inputs: | ||
| issue-numbers: | ||
| description: "Issue numbers to backfill (comma-separated)" | ||
| required: true | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| issue-to-task: | ||
| if: github.event_name == 'issues' || github.event_name == 'workflow_dispatch' | ||
| name: Create or update Athena task from GitHub issue | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| issues: write | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Sync issue to Athena | ||
| uses: ./.github/actions/sync-athena | ||
| with: | ||
| mode: issue_to_task | ||
| issue_number: ${{ inputs.issue-numbers }} | ||
| ticket_prefix: ${{ vars.ATHENA_TICKET_PREFIX || 'IEP' }} | ||
| editors: ${{ vars.ATHENA_EDITORS }} | ||
| co_authors: ${{ vars.ATHENA_CO_AUTHORS }} | ||
| athena_project_uuid: ${{ vars.ATHENA_PROJECT_UUID }} | ||
| athena_db_path: ${{ vars.ATHENA_DB_PATH }} | ||
| athena_base_url: ${{ secrets.ATHENA_BASE_URL }} | ||
| athena_token: ${{ secrets.ATHENA_TOKEN }} | ||
| registry_username: ${{ vars.SYNC_ATHENA_REGISTRY_USERNAME }} | ||
| registry_token: ${{ secrets.SYNC_ATHENA_REGISTRY_TOKEN }} | ||
|
|
||
| comment-to-task: | ||
| if: github.event_name == 'issue_comment' | ||
| name: Append issue/PR comment to matching Athena task | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| issues: read | ||
| pull-requests: read | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Sync comment to Athena | ||
| uses: ./.github/actions/sync-athena | ||
| with: | ||
| mode: comment_to_task | ||
| ticket_prefix: ${{ vars.ATHENA_TICKET_PREFIX || 'IEP' }} | ||
| athena_project_uuid: ${{ vars.ATHENA_PROJECT_UUID }} | ||
| athena_db_path: ${{ vars.ATHENA_DB_PATH }} | ||
| athena_base_url: ${{ secrets.ATHENA_BASE_URL }} | ||
| athena_token: ${{ secrets.ATHENA_TOKEN }} | ||
| registry_username: ${{ vars.SYNC_ATHENA_REGISTRY_USERNAME }} | ||
| registry_token: ${{ secrets.SYNC_ATHENA_REGISTRY_TOKEN }} | ||
|
|
||
| pr-to-task: | ||
| if: > | ||
| github.event_name == 'pull_request' && | ||
| github.event.pull_request.head.repo.full_name == github.repository | ||
| name: Link PR to its Athena task | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| pull-requests: read | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| - name: Sync PR to Athena | ||
| uses: ./.github/actions/sync-athena | ||
| with: | ||
| mode: pr_to_comment | ||
| ticket_prefix: ${{ vars.ATHENA_TICKET_PREFIX || 'IEP' }} | ||
| athena_project_uuid: ${{ vars.ATHENA_PROJECT_UUID }} | ||
| athena_db_path: ${{ vars.ATHENA_DB_PATH }} | ||
| athena_base_url: ${{ secrets.ATHENA_BASE_URL }} | ||
| athena_token: ${{ secrets.ATHENA_TOKEN }} | ||
| registry_username: ${{ vars.SYNC_ATHENA_REGISTRY_USERNAME }} | ||
| registry_token: ${{ secrets.SYNC_ATHENA_REGISTRY_TOKEN }} | ||
|
Comment on lines
+72
to
+93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🔎 Supported by static analysis🏁 Script executed: sed -n '1,130p' .github/workflows/sync-athena.yml
sed -n '1,120p' .github/actions/sync-athena/action.ymlRepository: espressif/idf-eclipse-plugin Length of output: 6596 🌐 Web query:
💡 Result: <source_evidence> Citations:
Run the secret-using PR sync from trusted workflow content. Move this job to a trusted 🧰 Tools🪛 zizmor (1.30.0)[warning] 82-82: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false (artipacked) [warning] 84-84: use GitHub's dedicated self-repository syntax (self-repository): use '$/...' instead of './...' (self-repository) 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🛡️ Analyzed with Security Review | 🟠 Major | ⚡ Quick win
Security Misconfiguration
Reachability: External
Exploitability: Difficult
CWE: CWE-494 — Download of Code Without Integrity Check
Pin the container image to a digest.
:latestcan resolve to different image content. The action pulls and runs that image withATHENA_TOKENandGITHUB_TOKEN. A registry writer or compromised publishing pipeline can replace the image and exfiltrate both credentials. Use a reviewed@sha256:...digest instead. Docker documents that a digest pins the exact image version. (docs.docker.com)🤖 Prompt for AI Agents