Skip to content
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

🐛 commit svg tester diffs to different branches #3211

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions .github/workflows/svg-compare-all-views.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ jobs:
if: ${{ github.repository_owner == 'owid' }}
shell: bash
run: |
echo "PUSH_BRANCH_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
echo "PUSH_BRANCH_NAME=${{ github.ref_name }}__all-views" >> $GITHUB_ENV
echo "TOKEN=${{ secrets.GITHUBPAT }}" >> $GITHUB_ENV

- name: Set branch name and token for runs from a fork
if: ${{ github.repository_owner != 'owid' }}
shell: bash
run: |
echo "PUSH_BRANCH_NAME=${{ github.repository_owner }}/${{ github.ref_name }}" >> $GITHUB_ENV
echo "PUSH_BRANCH_NAME=${{ github.repository_owner }}/${{ github.ref_name }}__all-views" >> $GITHUB_ENV
echo "TOKEN=${{ github.token }}" >> $GITHUB_ENV

# Checkout the owid-grapher-svgs repo into a subfolder. Use a Personal Access Token for checkout so the
Expand All @@ -35,20 +35,13 @@ jobs:
path: owid-grapher-svgs
token: ${{ env.TOKEN }}

# Create a branch on that repo that matches the branch name we are on in the owid-grapher repo
# Switch to or create a branch on that repo that matches the branch name we are on in the owid-grapher repo
# but only do this if we are not on master in owid-graphers (in this case we want to commit and push on master
# in owid-grapher-svgs as well)
- name: create owid-grapher-svgs local branch
if: ${{ env.PUSH_BRANCH_NAME != 'master'}}
working-directory: owid-grapher-svgs
continue-on-error: true
run: git branch ${{ env.PUSH_BRANCH_NAME }} || echo "Branch ${{ env.PUSH_BRANCH_NAME }} already exists"

# Checkout the branch we just created (but not if we are on master in owid-grapher)
- name: checkout owid-grapher-svgs local branch
if: ${{ env.PUSH_BRANCH_NAME != 'master'}}
working-directory: owid-grapher-svgs
run: git checkout ${{ env.PUSH_BRANCH_NAME }}
run: git branch ${{ env.PUSH_BRANCH_NAME }} && git checkout ${{ env.PUSH_BRANCH_NAME }}

# Run the verify tool overwriting any svgs. Stdout is piped to compare-result which will be a 0 byte file if everything works or contain failed grapher ids otherwise
- name: Generate SVGs and compare to reference
Expand All @@ -66,7 +59,7 @@ jobs:
repository: ./owid-grapher-svgs/
branch: ${{ env.PUSH_BRANCH_NAME }}
push_options: "--force"
commit_message: Automated commit with svg differences of all views triggered by commit https://github.com/owid/owid-grapher/commit/${{github.sha}}
commit_message: Automated commit with svg differences (all views) triggered by commit https://github.com/owid/owid-grapher/commit/${{github.sha}}

# The action fails if there were any errors.
- name: Fail with error message if we had errors
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/svg-compare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,13 @@ jobs:
path: owid-grapher-svgs
token: ${{ env.TOKEN }}

# Create a branch on that repo that matches the branch name we are on in the owid-grapher repo
# Switch to or create a branch on that repo that matches the branch name we are on in the owid-grapher repo
# but only do this if we are not on master in owid-graphers (in this case we want to commit and push on master
# in owid-grapher-svgs as well)
- name: create owid-grapher-svgs local branch
if: ${{ env.PUSH_BRANCH_NAME != 'master'}}
working-directory: owid-grapher-svgs
continue-on-error: true
run: git branch ${{ env.PUSH_BRANCH_NAME }} || echo "Branch ${{ env.PUSH_BRANCH_NAME }} already exists"

# Checkout the branch we just created (but not if we are on master in owid-grapher)
- name: checkout owid-grapher-svgs local branch
if: ${{ env.PUSH_BRANCH_NAME != 'master'}}
working-directory: owid-grapher-svgs
run: git checkout ${{ env.PUSH_BRANCH_NAME }}
run: git branch ${{ env.PUSH_BRANCH_NAME }} && git checkout ${{ env.PUSH_BRANCH_NAME }}

# Run the verify tool overwriting any svgs. Stdout is piped to compare-result which will be a 0 byte file if everything works or contain failed grapher ids otherwise
- name: Generate SVGs and compare to reference
Expand Down
Loading