Skip to content

Commit

Permalink
Merge pull request #145 from HerodotusDev/fix/workflow
Browse files Browse the repository at this point in the history
fix workflow with target branch
  • Loading branch information
rkdud007 committed Sep 12, 2024
2 parents c3a4410 + e562327 commit 146e2d3
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions .github/workflows/fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,22 @@ jobs:
run: |
cargo install --locked -f --path cli/
- name: Clone hdp-test repository
uses: actions/checkout@v4
with:
repository: HerodotusDev/hdp-test
token: ${{ secrets.REPO_ACCESS_TOKEN }}
path: hdp-test
- name: Clone and setup hdp-test repository
run: |
git clone https://x-access-token:${{ secrets.REPO_ACCESS_TOKEN }}@github.com/HerodotusDev/hdp-test.git hdp-test
cd hdp-test
git config user.name github-actions
git config user.email github-actions@github.com
# Check if branch exists on remote
if git ls-remote --exit-code --heads origin ${{ github.ref_name }} >/dev/null 2>&1; then
echo "Branch ${{ github.ref_name }} exists on remote, checking out"
git checkout ${{ github.ref_name }}
else
echo "Branch ${{ github.ref_name }} does not exist on remote, creating from main"
git checkout main
git checkout -b ${{ github.ref_name }}
fi
- name: Generate .env file
run: |
Expand All @@ -58,11 +68,6 @@ jobs:
- name: Commit and push new fixtures
run: |
cd hdp-test
git config user.name github-actions
git config user.email github-actions@github.com
git fetch origin
git checkout ${{ github.ref_name }}
git pull origin ${{ github.ref_name }}
git add .
git commit -m "Update fixtures"
git push origin ${{ github.ref_name }}
Expand All @@ -77,12 +82,13 @@ jobs:
with:
repository: HerodotusDev/hdp-test
token: ${{ secrets.REPO_ACCESS_TOKEN }}
fetch-depth: 0

- name: Merge fixtures to main
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git fetch origin
git checkout main
git merge origin/${{ github.ref_name }}
git merge --no-ff origin/${{ github.ref_name }} -m "Merge ${{ github.ref_name }} into main"
git push origin main

0 comments on commit 146e2d3

Please sign in to comment.