diff --git a/.github/workflows/svg-compare-all-views.yml b/.github/workflows/svg-compare-all-views.yml index 71472166537..ebc00be49f1 100644 --- a/.github/workflows/svg-compare-all-views.yml +++ b/.github/workflows/svg-compare-all-views.yml @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/svg-compare.yml b/.github/workflows/svg-compare.yml index 5c9c3e11e79..2cf7fa8e9ca 100644 --- a/.github/workflows/svg-compare.yml +++ b/.github/workflows/svg-compare.yml @@ -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