Skip to content
Open
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
47 changes: 40 additions & 7 deletions .github/workflows/pr-reviewer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,45 @@ jobs:
echo EOF
} >> "$GITHUB_ENV"

- uses: actions/github-script@v6
- name: Get github-actions bot comment id (if exists)
id: get_comment_id
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
comments_json=$(curl -s -L -X GET \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GH_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments)
comment_id=$(echo "$comments_json" | jq -r '[.[] | select(.user.login=="github-actions[bot]") | .id][0] // ""')
echo "comment_id=$comment_id" >> $GITHUB_ENV
echo "Resolved comment id: ${comment_id:-<none>}"

- name: Create or update PR review comment
uses: actions/github-script@v6
env:
COMMENT_ID: ${{ env.comment_id }}
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.response
})
const body = process.env.response || '(no response content)';
const existing = process.env.COMMENT_ID;
if (!existing) {
core.info('No existing github-actions[bot] comment. Creating a new one.');
const { data } = await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body
});
core.info(`Created comment id ${data.id}`);
} else {
core.info(`Updating existing comment id ${existing}`);
await github.rest.issues.updateComment({
owner: context.repo.owner,
repo: context.repo.repo,
comment_id: Number(existing),
body
});
core.info('Update complete');
}
4 changes: 4 additions & 0 deletions .github/workflows/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ jobs:
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}

- uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.13.3"

- name: Terraform Init
working-directory: components
env:
Expand Down
Loading