forked from swimlane/ngx-datatable
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
857218c
commit dcbe518
Showing
1 changed file
with
21 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -44,33 +44,36 @@ jobs: | |
cd snapshot-repo | ||
git config user.name "GitHub Actions" | ||
git config user.email "[email protected]" | ||
# Automatically generate branch name | ||
# Ensure remote is set up correctly | ||
git remote set-url origin https://${SNAPSHOT_REPO_TOKEN}@github.com/chintankavathia/ngx-datatable-snapshots.git | ||
# Fetch remote branches to avoid the "no upstream branch" error | ||
git fetch origin | ||
BRANCH_NAME="snapshot-update-${{ github.run_id }}" | ||
git checkout -b $BRANCH_NAME | ||
git push --set-upstream origin $BRANCH_NAME | ||
- name: Copy generated snapshots | ||
run: | | ||
rsync -av --delete playwright/snapshots/ snapshot-repo/ | ||
rsync -av --delete playwright/snapshots/ snapshot-repo/snapshots | ||
- name: Commit and push changes | ||
- name: Commit and push changes to snapshot repo | ||
working-directory: snapshot-repo | ||
run: | | ||
git add . | ||
# Automatically generate commit message | ||
COMMIT_MESSAGE="Update Playwright snapshots (Run ID: ${{ github.run_id }})" | ||
git commit -m "$COMMIT_MESSAGE" | ||
git commit -m "$COMMIT_MESSAGE" || echo "No changes to commit" | ||
# Ensure remote is set up correctly | ||
git remote set-url origin https://${{ secrets.SNAPSHOT_REPO_TOKEN }}@github.com/chintankavathia/ngx-datatable-snapshots.git | ||
git push origin $BRANCH_NAME | ||
- name: Create pull request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.SNAPSHOT_REPO_TOKEN }} | ||
repository: chintankavathia/ngx-datatable-snapshots.git | ||
base: main | ||
head: $BRANCH_NAME | ||
# Automatically generate title and body | ||
title: 'Update Playwright Snapshots (Run ID: ${{ github.run_id }})' | ||
body: | | ||
This PR updates the Playwright snapshots generated by workflow run ID: ${{ github.run_id }}. | ||
- Base branch: ${{ github.ref_name }} | ||
- Commit: ${{ github.sha }} | ||
- name: Create a pull request | ||
run: | | ||
git remote set-url origin https://${{ secrets.SNAPSHOT_REPO_TOKEN }}@github.com/chintankavathia/ngx-datatable-snapshots.git | ||
# We need to re-auth in order to create PR | ||
echo "${{ secrets.SNAPSHOT_REPO_TOKEN }}" | gh auth login --with-token | ||
gh pr create --base main --head snapshot-update-${{ github.run_id }} --title "Update Playwright snapshots" --body "Automated PR to update snapshots based on run ID ${{ github.run_id }}." |