-
Notifications
You must be signed in to change notification settings - Fork 0
chore: added redeploy preview workflow (#DS-4784) #191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
95a5808
chore: added redeploy preview workflow (#DS-4784)
artembelik 1c693b5
refactor: review
artembelik e1df839
Potential fix for pull request finding
artembelik 5a08c87
Potential fix for pull request finding
artembelik ffa0eb5
refactor: review
artembelik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,60 @@ | ||
| # Triggered workflow by PR comment: /approve-snapshots | ||
| # | ||
| # ⚠️ This job checks out and runs PR-controlled code with a repo write token. Only comment | ||
| # /approve-snapshots after reviewing the PR's contents — the author_association check below | ||
| # only verifies the commenter, not the safety of the code being run. | ||
| name: E2E approve snapshots | ||
|
|
||
| on: | ||
| issue_comment: | ||
| types: [created] | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| contents: write # for stefanzweifel/git-auto-commit-action to push changes | ||
| issues: write # for actions/github-script to react to the triggering comment | ||
| pull-requests: write # for thollander/actions-comment-pull-request to comment on PRs | ||
|
artembelik marked this conversation as resolved.
|
||
|
|
||
| jobs: | ||
| approve_snapshots: | ||
| if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/approve-snapshots') }} | ||
| if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/approve-snapshots') && contains(fromJSON('["OWNER", "MEMBER"]'), github.event.comment.author_association) }} | ||
|
artembelik marked this conversation as resolved.
|
||
| runs-on: ubuntu-24.04-arm | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - uses: xt0rted/pull-request-comment-branch@v3 | ||
| id: comment-branch | ||
| - uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| await github.rest.reactions.createForIssueComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: context.payload.comment.id, | ||
| content: 'eyes', | ||
| }); | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| ref: ${{ steps.comment-branch.outputs.head_ref }} | ||
| - uses: thollander/actions-comment-pull-request@v3 | ||
| with: | ||
| message: 🔄 [Updating](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) snapshots. | ||
| - run: npm run e2e:docker:update-snapshots | ||
| - uses: stefanzweifel/git-auto-commit-action@v7 | ||
|
artembelik marked this conversation as resolved.
|
||
| id: commit-and-push | ||
| with: | ||
| commit_message: 'test: updated e2e snapshots' | ||
| file_pattern: '**/*.png **/*.txt' | ||
| - uses: thollander/actions-comment-pull-request@v3 | ||
| - uses: actions/github-script@v7 | ||
| if: ${{ steps.commit-and-push.outputs.changes_detected == 'true' }} | ||
| with: | ||
| message: ✅ Snapshots [updated](https://github.com/${{ github.repository }}/pull/${{ github.event.issue.number }}/commits/${{ steps.commit-and-push.outputs.commit_hash }})! | ||
| script: | | ||
| await github.rest.reactions.createForIssueComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: context.payload.comment.id, | ||
| content: 'rocket', | ||
| }); | ||
| - uses: thollander/actions-comment-pull-request@v3 | ||
| if: ${{ steps.commit-and-push.outputs.changes_detected != 'true' }} | ||
| with: | ||
| message: ⚠️ No snapshots changes detected. | ||
| - uses: thollander/actions-comment-pull-request@v3 | ||
| if: ${{ failure() }} | ||
|
artembelik marked this conversation as resolved.
|
||
| with: | ||
| message: 🚨 Failed to [update](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) snapshots. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| # Triggered workflow by PR comment: /redeploy-preview | ||
| # | ||
| # ⚠️ This job checks out and builds PR-controlled code with a Firebase deployment secret. | ||
| # Only comment /redeploy-preview after reviewing the PR's contents — the author_association | ||
| # check below only verifies the commenter, not the safety of the code being built. | ||
| name: Redeploy documentation preview | ||
|
|
||
| on: | ||
| issue_comment: | ||
| types: [created] | ||
|
|
||
| permissions: | ||
| checks: write # for FirebaseExtended/action-hosting-deploy to create a check run | ||
| contents: read # for actions/checkout to read the repository | ||
| issues: write # for actions/github-script to react to the triggering comment | ||
| pull-requests: write # for FirebaseExtended/action-hosting-deploy to comment on PRs | ||
|
|
||
| jobs: | ||
| redeploy: | ||
| if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/redeploy-preview') && contains(fromJSON('["OWNER", "MEMBER"]'), github.event.comment.author_association) }} | ||
|
artembelik marked this conversation as resolved.
|
||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: xt0rted/pull-request-comment-branch@v3 | ||
| id: comment-branch | ||
| - uses: actions/github-script@v7 | ||
| with: | ||
| script: | | ||
| await github.rest.reactions.createForIssueComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: context.payload.comment.id, | ||
| content: 'eyes', | ||
| }); | ||
| - uses: actions/checkout@v7 | ||
| with: | ||
| ref: ${{ steps.comment-branch.outputs.head_ref }} | ||
|
artembelik marked this conversation as resolved.
|
||
| persist-credentials: false | ||
| - uses: ./.github/actions/setup-node | ||
| # Run dev mode build to generate the `e2eRoute` | ||
| # @see dev/ag-grid-angular/src/main.ts | ||
| - run: yarn run build --configuration=development | ||
| - uses: FirebaseExtended/action-hosting-deploy@v0.11.0 | ||
| with: | ||
| repoToken: '${{ secrets.GITHUB_TOKEN }}' | ||
| firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_KOOBIQ }}' | ||
| firebaseToolsVersion: ^13.35.1 | ||
| expires: 3d | ||
| channelId: data-grid-pr-${{ github.event.issue.number }} | ||
| projectId: koobiq | ||
| target: next | ||
|
artembelik marked this conversation as resolved.
|
||
| - uses: actions/github-script@v7 | ||
| if: ${{ success() }} | ||
| with: | ||
|
artembelik marked this conversation as resolved.
|
||
| script: | | ||
| await github.rest.reactions.createForIssueComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: context.payload.comment.id, | ||
| content: 'rocket', | ||
| }); | ||
| - uses: thollander/actions-comment-pull-request@v3.0.1 | ||
| if: ${{ failure() }} | ||
|
artembelik marked this conversation as resolved.
|
||
| with: | ||
| message: 🚨 Failed to [redeploy](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) documentation preview. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.