-
Notifications
You must be signed in to change notification settings - Fork 3
Medic #1520
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
base: main
Are you sure you want to change the base?
Medic #1520
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 |
|---|---|---|
|
|
@@ -9,3 +9,8 @@ | |
|
|
||
| # data-analytics - temporarily add devex-cicd for dependency bumps | ||
| /actions/pr-quality-check/ @smartcontractkit/data-analytics @smartcontractkit/devex-cicd | ||
|
|
||
| # Medic (auto workflow retry only) | ||
| /actions/medic-workflow-retry-auto/** @smartcontractkit/foundations | ||
| /libs/medic/** @smartcontractkit/foundations | ||
| /.github/workflows/medic-*.yml @smartcontractkit/foundations | ||
|
Collaborator
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. We should use a reusable workflow with |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Medic — auto workflow retry (`workflow_run`). Override in consuming repositories. | ||
| # https://github.com/smartcontractkit/.github | ||
|
|
||
| # Used for PR author allowlist when deciding whether to auto-retry a failed workflow. | ||
| merge_conflict: | ||
| allowed_authors: | ||
| - patrickhuie19 | ||
|
Collaborator
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. Can we specify teams instead of individuals?
Contributor
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. The default CI token doesn't have read access to org teams/members. The workaround is what CORA does: https://github.com/smartcontractkit/.github/blob/main/.github/workflows/reusable-codeowners-review-analysis.yml#L62-L68 which uses the org-wide members GATI to get a GH token with that access. But then you have to juggle the 2 tokens, because the org-level token has access to nothing else. |
||
| max_attempts: 3 | ||
| activity_threshold_hours: 48 | ||
| skip_labels: | ||
| - medic-skip | ||
| - do not merge | ||
| - do-not-merge | ||
| - wip | ||
|
|
||
| workflow_retry: | ||
| max_attempts: 3 | ||
| retryable: [] | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,45 @@ | ||||||
| name: Medic - Auto Workflow Retry | ||||||
|
|
||||||
| on: | ||||||
| workflow_call: | ||||||
| secrets: | ||||||
| GCP_SERVICE_ACCOUNT_KEY: | ||||||
| required: true | ||||||
| GCP_PROJECT_ID: | ||||||
| required: true | ||||||
|
|
||||||
| permissions: | ||||||
| actions: write | ||||||
| checks: read | ||||||
| pull-requests: write | ||||||
| contents: read | ||||||
|
|
||||||
| concurrency: | ||||||
| group: medic-auto-retry-${{ github.event.workflow_run.id }} | ||||||
| cancel-in-progress: false | ||||||
|
|
||||||
| jobs: | ||||||
| auto-retry: | ||||||
| name: Auto retry failed workflow | ||||||
| if: > | ||||||
| github.event.workflow_run.conclusion == 'failure' && | ||||||
| github.event.workflow_run.run_attempt < 3 | ||||||
|
Contributor
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. This is hardcoded to 3 but the medic config allows for configuring max attempts. |
||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - name: Checkout | ||||||
| uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||||||
|
Check warning on line 30 in .github/workflows/medic-workflow-retry-auto.yml
|
||||||
|
Collaborator
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.
Suggested change
This solves the node20 issue and for official GH actions, we generally are OK with pinning to a major tag. |
||||||
|
|
||||||
| - name: Authenticate to GCP | ||||||
| uses: google-github-actions/auth@c200f3691d83b41bf9bbd8638997a462592937ed # v2.1.13 | ||||||
|
Check warning on line 33 in .github/workflows/medic-workflow-retry-auto.yml
|
||||||
|
Contributor
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. Bump to v3 |
||||||
| with: | ||||||
| credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }} | ||||||
|
Collaborator
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. Can we use federated access with OIDC for GCP instead of hardcoded key similar to how we use AWS IAM roles? See: workload_identity_provider via https://github.com/google-github-actions/auth
Collaborator
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. Also, would this be an org-wide secret? That's the only way this would work as-is. Otherwise, for each repo that we want to use this workflow with, we'd have to set the repo-level secret. If we used OIDC, we could perhaps set it to allow any repo in the org |
||||||
| create_credentials_file: true | ||||||
| export_environment_variables: true | ||||||
|
|
||||||
| - name: Auto retry failed workflow | ||||||
| uses: ./actions/medic-workflow-retry-auto | ||||||
| with: | ||||||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||||||
| env: | ||||||
| ANTHROPIC_VERTEX_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }} | ||||||
| CLOUD_ML_REGION: us-east5 | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| name: Medic – Auto Workflow Retry | ||
| description: | ||
| Automatically retries failed workflow runs triggered by workflow_run events | ||
|
|
||
| inputs: | ||
| github-token: | ||
| description: GitHub token for API access and workflow re-run | ||
| required: true | ||
|
|
||
| runs: | ||
| using: node24 | ||
| main: dist/index.js |
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.
Let's make sure this team has write access to the repo.