Skip to content

Commit

Permalink
CI: Fix minor issues in on-demand test and format workflows (#198)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsteers authored Apr 18, 2024
1 parent 88af60e commit 3702e71
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/fix-pr-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ jobs:
steps:

# Custom steps to fetch the PR and checkout the code:

- name: Checkout PR
- name: Checkout Airbyte
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
# Important that this is set so that CI checks are triggered again
# Without this we would be forever waiting on required checks to pass
token: ${{ secrets.GH_PAT_APPROVINGTON_OCTAVIA }}

- name: Checkout PR (${{ github.event.inputs.pr }})
uses: dawidd6/action-checkout-pr@v1
with:
Expand All @@ -60,9 +62,11 @@ jobs:
run: echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_OUTPUT

- name: Append comment with job run link
id: first-comment-action
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ github.event.inputs.comment-id }}
issue-number: ${{ github.event.inputs.pr }}
body: |
> PR auto-fix job started... [Check job output.][1]
Expand Down Expand Up @@ -129,7 +133,7 @@ jobs:
git add .
git commit -m "Auto-fix lint issues (unsafe)"
- name: Push changes
- name: Push changes to '(${{ steps.pr-info.outputs.repo }})'
if: steps.git-diff.outputs.changes == 'true' || steps.git-diff-2.outputs.changes == 'true'
run: |
git remote add contributor https://github.com/${{ steps.pr-info.outputs.repo }}.git
Expand All @@ -139,7 +143,7 @@ jobs:
uses: peter-evans/create-or-update-comment@v4
if: steps.git-diff.outputs.changes == 'true' || steps.git-diff-2.outputs.changes == 'true'
with:
comment-id: ${{ github.event.inputs.comment-id }}
comment-id: ${{ steps.first-comment-action.outputs.comment-id }}
reactions: hooray
body: |
> ✅ Changes applied successfully.
Expand All @@ -148,7 +152,7 @@ jobs:
uses: peter-evans/create-or-update-comment@v4
if: steps.git-diff.outputs.changes != 'true' && steps.git-diff-2.outputs.changes != 'true'
with:
comment-id: ${{ github.event.inputs.comment-id }}
comment-id: ${{ steps.first-comment-action.outputs.comment-id }}
reactions: "+1"
body: |
> 🟦 Job completed successfully (no changes).
Expand All @@ -157,7 +161,7 @@ jobs:
uses: peter-evans/create-or-update-comment@v4
if: failure()
with:
comment-id: ${{ github.event.inputs.comment-id }}
comment-id: ${{ steps.first-comment-action.outputs.comment-id }}
reactions: confused
body: |
> ❌ Job failed.
6 changes: 5 additions & 1 deletion .github/workflows/test-pr-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ jobs:
id: vars
run: echo "run-url=https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_OUTPUT
- name: Append comment with job run link
id: first-comment-action
uses: peter-evans/create-or-update-comment@v4
with:
comment-id: ${{ github.event.inputs.comment-id }}
issue-number: ${{ github.event.inputs.pr }}
body: |
> PR test job started... [Check job output.][1]
Expand Down Expand Up @@ -92,6 +94,7 @@ jobs:
- name: Append success comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.inputs.pr }}
comment-id: ${{ github.event.inputs.comment-id }}
reactions: hooray
body: |
Expand All @@ -100,13 +103,14 @@ jobs:
log-failure-comment:
name: Append 'Failure' Comment
# This job will only run if the workflow fails
needs: [pytest-on-demand]
needs: [pytest-on-demand, log-starting-comment]
if: always() && needs.pytest-on-demand.result == 'failure'
runs-on: ubuntu-latest
steps:
- name: Append failure comment
uses: peter-evans/create-or-update-comment@v4
with:
issue-number: ${{ github.event.inputs.pr }}
comment-id: ${{ github.event.inputs.comment-id }}
reactions: confused
body: |
Expand Down

0 comments on commit 3702e71

Please sign in to comment.