diff --git a/.github/workflows/example.yml b/.github/workflows/example.yml index ab205f1..101c757 100644 --- a/.github/workflows/example.yml +++ b/.github/workflows/example.yml @@ -3,6 +3,9 @@ on: pull_request: types: [opened, synchronize] +permissions: + pull-requests: write + jobs: e2e-tests: runs-on: ubuntu-latest diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 735133e..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: 'Test' -on: - push: - branches: [main] - pull_request: - branches: [main] - -jobs: - test-action: - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Test replace-comment action - uses: ./ - with: - issue-number: ${{ github.event.pull_request.number }} - body-includes: '' - comment-author: 'github-actions[bot]' - body: | - - ## ๐Ÿงช Test Comment - This comment was created by the replace-comment action! - **PR:** #${{ github.event.pull_request.number }} - **Commit:** ${{ github.sha }} - **Run:** [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - **Time:** $(date -u) - reactions: 'rocket,eyes' diff --git a/MIGRATION.md b/MIGRATION.md deleted file mode 100644 index 045b4bb..0000000 --- a/MIGRATION.md +++ /dev/null @@ -1,84 +0,0 @@ -# How to Update Your E2E Workflow - -Here's how you can replace the 3-step process in your original workflow with the new `replace-comment` action. - -## Before (your current workflow) - -```yaml -- name: Find existing E2E results comment - uses: peter-evans/find-comment@v3 - id: find-comment - with: - token: ${{ secrets.PRICERA_GITHUB_TOKEN }} - repository: ${{ github.event.client_payload.repo-name || inputs.repo-name }} - issue-number: ${{ inputs.pr-number || github.event.client_payload.pr-number }} - comment-author: 'pricera' - body-includes: '' - -- name: Delete existing E2E results comment - if: steps.find-comment.outputs.comment-id - run: | - curl -L \ - -X DELETE \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer ${{ secrets.PRICERA_GITHUB_TOKEN }}" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - "https://api.github.com/repos/${{ github.event.client_payload.repo-name || inputs.repo-name }}/issues/comments/${{ steps.find-comment.outputs.comment-id }}" - -- name: Comment PR with E2E Results - uses: peter-evans/create-or-update-comment@v4 - with: - token: ${{ secrets.PRICERA_GITHUB_TOKEN }} - repository: ${{ github.event.client_payload.repo-name || inputs.repo-name }} - issue-number: ${{ inputs.pr-number || github.event.client_payload.pr-number }} - body: | - - ## ${{ needs.run-tests.result == 'success' && 'โœ… E2E Tests Passed' || 'โŒ E2E Tests Failed' }} - # ... rest of your content -``` - -## After (using replace-comment) - -```yaml -- name: Comment PR with E2E Results - uses: johanwulf/replace-comment@v1 - with: - token: ${{ secrets.PRICERA_GITHUB_TOKEN }} - repository: ${{ github.event.client_payload.repo-name || inputs.repo-name }} - issue-number: ${{ inputs.pr-number || github.event.client_payload.pr-number }} - comment-author: 'pricera' - body-includes: '' - body: | - - ## ${{ needs.run-tests.result == 'success' && 'โœ… E2E Tests Passed' || 'โŒ E2E Tests Failed' }} - - **Testing Branch:** `${{ github.event.client_payload.branch-name || inputs.branch-name || 'N/A' }}` - **Workflow Run:** [View Details](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - --- - -
- ๐ŸŽฏ Microfrontend Versions - ${{ needs.prepare-frontend.outputs.frontend-info || 'No version info available' }} -
- -
- ๐Ÿ”ง Backend Versions - ${{ needs.prepare-backend.outputs.backend-info || 'No version info available' }} -
- - --- - ### ๐Ÿ”ง Test Results - # - ${{ needs.run-tests.result == 'success' && '- **Status:** All tests passed' || needs.process-results.outputs.failed-tests }} -``` - -## Benefits - -- โœ… **3 steps โ†’ 1 step** - Much cleaner workflow -- โœ… **Comments always at bottom** - Easy to find latest results -- โœ… **Reuses Peter Evans' proven actions** - No reinventing the wheel -- โœ… **Same functionality** - Works exactly like your current setup -- โœ… **Better maintenance** - Centralized logic in one action - -The comment will now appear at the bottom of the PR conversation every time, making it much easier to find the latest test results! diff --git a/README.md b/README.md index df3add5..e9790b8 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Replace Comment +# replace-comment A GitHub Action that finds, deletes, and recreates a comment to move it to the bottom of the conversation. This is perfect for CI/CD status updates, bot notifications, and any content you want to keep highly visible.