Skip to content
21 changes: 16 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,32 +90,43 @@
git commit -m "${{ github.event.number && format('PR-{0}', github.event.number) || join(github.event.commits.*.message, ', ') }}" || true
git push

testing:
name: Execute the AI-assisted action defined in this PR
testing-summary:
name: Execute the action (PR Summary) defined in this PR
runs-on: [ubuntu-latest]
needs: create-release
if: ${{ github.ref_name != 'main' }}
steps:
- name: Checkout release branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ env.RELEASE_BRANCH }}
- name: Run the AI-assisted action (PR Summary)
uses: ./pr-summary # action.yml is in the pr-summary folder of the release branch
with:
aicore-service-key: ${{ secrets.AICORE_SERVICE_KEY }}
model: gpt-4o
model: o3
exclude-files: package-lock.json
display-mode: comment-delta
- name: Run the AI-assisted action (PR Summary)

testing-review:
name: Execute the action (PR Review) defined in this PR
runs-on: [ubuntu-latest]
needs: create-release
if: ${{ github.ref_name != 'main' }}
steps:
- name: Checkout release branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ env.RELEASE_BRANCH }}
- name: Run the AI-assisted action (PR Review)
uses: ./pr-review # action.yml is in the pr-review folder of the release branch
with:
aicore-service-key: ${{ secrets.AICORE_SERVICE_KEY }}
model: gpt-4o
model: o3
exclude-files: package-lock.json
display-mode: review-comment-delta

Choose a reason for hiding this comment

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

Both testing-summary and testing-review repeat the same boilerplate (runs-on, needs, checkout step, etc.). You can eliminate duplication and improve maintainability by employing a matrix strategy or by using a reusable composite action. Example with a matrix:

  pr-jobs:
    strategy:
      matrix:
        include:
          - name: PR Summary
            uses: ./pr-summary
            model: gpt-4o
            display: comment-delta
          - name: PR Review
            uses: ./pr-review
            model: gpt-4o
            display: review-comment-delta
    name: Execute ${{ matrix.name }} action defined in this PR
    runs-on: ubuntu-latest
    needs: create-release
    if: ${{ github.ref_name != 'main' }}
    steps:
      - uses: actions/checkout@v4
        with:
          ref: ${{ env.RELEASE_BRANCH }}
      - name: Run AI-assisted ${{ matrix.name }}
        uses: ${{ matrix.uses }}
        with:
          aicore-service-key: ${{ secrets.AICORE_SERVICE_KEY }}
          model: ${{ matrix.model }}
          exclude-files: package-lock.json
          display-mode: ${{ matrix.display }}

This drastically shortens the workflow file and ensures consistency between both jobs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not possible: "In order to enact policies like only using actions defined in the org or repo we can’t allow actions to dynamically change at runtime. So using any sort of dynamic value in uses is not something we will be able to support."


update-tags:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
name: Update semantic version tags
runs-on: [ubuntu-latest]
needs: create-release
Expand Down