Skip to content
Merged
Show file tree
Hide file tree
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
22 changes: 19 additions & 3 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ jobs:
with:
path: ./

- name: Checkout kubecost/github-actions
uses: actions/checkout@v2
with:
repository: kubecost/github-actions
token: ${{ secrets.CPA_ACTIONS_PAT }}
path: ./github-actions

- name: Run predict on test files
id: prediction
uses: ./
Expand All @@ -22,12 +29,21 @@ jobs:
run: |
echo "${{ steps.prediction.outputs.PREDICTION_TABLE }}"

- name: Update PR with prediction results
uses: edumserrano/find-create-or-update-comment@v1
- name: Find existing PR comment
uses: ./github-actions/find-comment
id: find-comment
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body-includes: '<!-- kubecost-prediction-results -->'
comment-author: 'github-actions[bot]'
body-includes: '<!-- kubecost-prediction-results -->'

- name: Create or update PR comment with prediction results
uses: ./github-actions/create-or-update-comment
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.find-comment.outputs.comment-id }}
edit-mode: replace
body: |
<!-- kubecost-prediction-results -->
Expand Down
36 changes: 26 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,25 @@ below.
# is a directory and process all .yaml/.yml files it finds.
path: ./repo

# Write/update a comment with the prediction results.
- name: Update PR with prediction results
uses: edumserrano/find-create-or-update-comment@v1
# Find existing PR comment, then create or update it with prediction results.
- name: Find existing PR comment
uses: kubecost/github-actions/find-comment@main
id: find-comment
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body-includes: '<!-- kubecost-prediction-results -->'
comment-author: 'github-actions[bot]'
body-includes: '<!-- kubecost-prediction-results -->'
- name: Create or update PR comment with prediction results
uses: kubecost/github-actions/create-or-update-comment@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.find-comment.outputs.comment-id }}
edit-mode: replace
body: |
<!-- kubecost-prediction-results -->

## Kubecost's total cost prediction for K8s YAML Manifests in this PR

\```
Expand Down Expand Up @@ -135,17 +143,25 @@ jobs:
#
# kubecost_api_path: "http://localhost:9090/model"

# Write/update a comment with the prediction results.
- name: Update PR with prediction results
uses: edumserrano/find-create-or-update-comment@v1
# Find existing PR comment, then create or update it with prediction results.
- name: Find existing PR comment
uses: kubecost/github-actions/find-comment@main
id: find-comment
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
body-includes: '<!-- kubecost-prediction-results -->'
comment-author: 'github-actions[bot]'
body-includes: '<!-- kubecost-prediction-results -->'
- name: Create or update PR comment with prediction results
uses: kubecost/github-actions/create-or-update-comment@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.pull_request.number }}
comment-id: ${{ steps.find-comment.outputs.comment-id }}
edit-mode: replace
body: |
<!-- kubecost-prediction-results -->

## Kubecost's total cost prediction for K8s YAML Manifests in this PR

\```
Expand Down
Loading