Skip to content

Commit

Permalink
Try environment thing
Browse files Browse the repository at this point in the history
  • Loading branch information
cansavvy committed Aug 19, 2022
1 parent 3af67d7 commit ac469b8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ jobs:
with:
check_type: spelling
error_min: 3
gh_pat: secrets.GH_PAT
environment: dev
secrets:
gh_pat: ${{ secrets.GH_PAT }}

url-check:
name: Check URLs
Expand All @@ -76,7 +78,9 @@ jobs:
with:
check_type: urls
error_min: 0
gh_pat: secrets.GH_PAT
environment: dev
secrets:
gh_pat: ${{ secrets.GH_PAT }}

quiz-check:
name: Check quiz formatting
Expand All @@ -86,7 +90,9 @@ jobs:
with:
check_type: quiz_format
error_min: 0
gh_pat: secrets.GH_PAT
environment: dev
secrets:
gh_pat: ${{ secrets.GH_PAT }}

############################# Style the code ###################################
style-code:
Expand Down
17 changes: 12 additions & 5 deletions .github/workflows/report-maker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,43 @@ on:
error_min:
default: 0
type: number
gh_pat:
environment:
type: string
description: environment to deploy to
required: true
secrets:
gh_pat:
required: true

jobs:
error-check:
runs-on: ubuntu-latest
container:
image: jhudsl/course_template:main
environment: ${{ inputs.environment }}

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ inputs.gh_pat }}
token: $gh_pat
env:
gh_pat: ${{ secrets.gh_pat }}

- name: Make branch if it doesn't exist
run: |
branch_name='preview-${{ github.event.pull_request.number }}'
exists=$(git ls-remote https://${{ secrets.GH_PAT }}@github.com/$GITHUB_REPOSITORY $branch_name | wc -l | xargs)
exists=$(git ls-remote https://$gh_pat@github.com/$GITHUB_REPOSITORY $branch_name | wc -l | xargs)
if [[ $exists == 0 ]];then
echo branch doesnt exist
git checkout -b $branch_name || echo branch exists
git push --set-upstream origin $branch_name
else
echo branch does exist
fi
shell: bash
env:
gh_pat: ${{ secrets.gh_pat }}

- name: Run the check
uses: jhudsl/ottr-reports@main
Expand Down

0 comments on commit ac469b8

Please sign in to comment.