Skip to content

release(hive-cli): 0.6.3 #56

release(hive-cli): 0.6.3

release(hive-cli): 0.6.3 #56

Workflow file for this run

name: Review Pull Request
on:
pull_request:
types: [ready_for_review]
env:
BUILDER_CODE: 1
LINTER_CODE: 1
jobs:
review-pr:
name: Review PR
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Run Linter
run: |
echo ${{ github.event.pull_request.head.sha }}
set +e
log=$(bash scripts/linter.sh ${{ github.event.pull_request.head.sha }})
code="$?"
echo "LINTER_CODE=$code" >> $GITHUB_ENV
{
echo 'LINTER_LOG<<EOF'
echo -e "${log}"
echo EOF
} >> "$GITHUB_ENV"
- name: Comment Linter Report when linter reports an error
if: env.LINTER_CODE != '0'
run: |
echo -e "${LINTER_LOG}\nI will revert the PR to draft mode." | gh issue comment "$NUMBER" -F -
gh pr ready ${{ github.event.pull_request.number }} --undo
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.number }}
- if: env.LINTER_CODE != '0'
name: Fail when linter reports an error
uses: actions/github-script@v7
with:
script: core.setFailed('Linter returned an error. Please fix the errors and try again.')
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker Image
run: |
set +e
bash scripts/builder.sh
code="$?"
echo "BUILDER_CODE=$code" >> $GITHUB_ENV
echo "BUILDER_LOG=Builder: ✅ Build successful.\nBuilder: 👍 PR is ready for merge." >> $GITHUB_ENV
- name: Add Build Info to Comment
if: env.BUILDER_CODE != '0'
run: |
{
echo 'BUILDER_LOG<<EOF'
echo -e "Builder: ❌ Build failed. Please check the Dockerfile for errors."
echo -e "Builder: 👉 Check the logs for more information: https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
echo -e "I will revert the PR to draft mode."
echo EOF
} >> "$GITHUB_ENV"
- name: Comment Build Report
run: echo -e "${LINTER_LOG}\n${BUILDER_LOG}" | gh issue comment "$NUMBER" -F -
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
NUMBER: ${{ github.event.number }}
- name: Change PR to Draft when build fails
if: env.BUILDER_CODE != '0'
env:
GH_TOKEN: ${{ github.token }}
run: gh pr ready ${{ github.event.pull_request.number }} --undo
- if: env.BUILDER_CODE != '0'
name: Fail PR
uses: actions/github-script@v7
with:
script: core.setFailed('Linter returned an error. Please fix the errors and try again.')