Change the list update workflow testing configuration

Update the testing branch for the software list update workflow to
include the SHA of the commit that triggers the workflow. This should
help track down problems if there is a failure in testing/rendering.
pull/412/head
Nicholas McDonnell 2 years ago
parent cf9549fb5f
commit 1c1d06ef95
No known key found for this signature in database
GPG Key ID: 7994ADE2A56BE5D1
  1. 20
      .github/workflows/update_software_list.yml

@ -8,15 +8,18 @@ on:
env: env:
PIP_CACHE_DIR: ~/.cache/pip PIP_CACHE_DIR: ~/.cache/pip
WORKING_BRANCH_NAME: testing/update_software_list TESTING_BRANCH_BASE: testing/update_software_list
jobs: jobs:
setup: setup:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
# Commit author information for git
git_author: ${{ steps.git-config.outputs.author }} git_author: ${{ steps.git-config.outputs.author }}
git_email: ${{ steps.git-config.outputs.email }} git_email: ${{ steps.git-config.outputs.email }}
git_user: ${{ steps.git-config.outputs.user }} git_user: ${{ steps.git-config.outputs.user }}
# The name of the branch used for testing
testing_branch: ${{ steps.testing-branch.outputs.name }}
steps: steps:
- id: git-config - id: git-config
run: | run: |
@ -26,6 +29,11 @@ jobs:
env: env:
GIT_EMAIL: ${{ fromJson(secrets.GIT_AUTHOR_INFORMATION).user.email }} GIT_EMAIL: ${{ fromJson(secrets.GIT_AUTHOR_INFORMATION).user.email }}
GIT_USER: ${{ fromJson(secrets.GIT_AUTHOR_INFORMATION).user.name }} GIT_USER: ${{ fromJson(secrets.GIT_AUTHOR_INFORMATION).user.name }}
- id: testing-branch
run: echo "::set-output name=name::$BASE_BRANCH/$COMMIT_SHA"
env:
BASE_BRANCH: ${{ env.TESTING_BRANCH_BASE }}
COMMIT_SHA: ${{ github.sha }}
generate_list_update: generate_list_update:
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: setup needs: setup
@ -59,7 +67,7 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: pip install --upgrade --requirement config/requirements.txt run: pip install --upgrade --requirement config/requirements.txt
- name: Create the branch for test validation - name: Create the branch for test validation
run: git switch --create ${{ env.WORKING_BRANCH_NAME }} run: git switch --create ${{ needs.setup.outputs.testing_branch }}
- name: Generate a normalized YAML file - name: Generate a normalized YAML file
run: normalize-yml data/cisagov.yml > normalized.yml run: normalize-yml data/cisagov.yml > normalized.yml
- name: Generate a Markdown table from the normalized YAML file - name: Generate a Markdown table from the normalized YAML file
@ -69,7 +77,7 @@ jobs:
- id: commit-for-testing - id: commit-for-testing
uses: stefanzweifel/git-auto-commit-action@v4 uses: stefanzweifel/git-auto-commit-action@v4
with: with:
branch: ${{ env.WORKING_BRANCH_NAME }} branch: ${{ needs.setup.outputs.testing_branch }}
commit_message: Update the software list commit_message: Update the software list
commit_user_name: ${{ needs.setup.outputs.git_user }} commit_user_name: ${{ needs.setup.outputs.git_user }}
commit_user_email: ${{ needs.setup.outputs.git_email }} commit_user_email: ${{ needs.setup.outputs.git_email }}
@ -92,12 +100,12 @@ jobs:
- uses: lewagon/wait-on-check-action@v1.0.0 - uses: lewagon/wait-on-check-action@v1.0.0
with: with:
check-name: lint check-name: lint
ref: ${{ env.WORKING_BRANCH_NAME }} ref: ${{ needs.setup.outputs.testing_branch }}
repo-token: ${{ github.token }} repo-token: ${{ github.token }}
- name: Merge the testing branch - name: Merge the testing branch
run: | run: |
git fetch git fetch
git merge origin/${{ env.WORKING_BRANCH_NAME }} git merge origin/${{ needs.setup.outputs.testing_branch }}
git push git push
- name: Cleanup testing branch - name: Cleanup testing branch
run: git push -d origin ${{ env.WORKING_BRANCH_NAME }} run: git push -d origin ${{ needs.setup.outputs.testing_branch }}

Loading…
Cancel
Save