Skip to content

Commit

Permalink
Fix permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
goruha committed Aug 29, 2024
1 parent cb27332 commit a469a37
Showing 1 changed file with 35 additions and 42 deletions.
77 changes: 35 additions & 42 deletions .github/workflows/shared-terraform-chatops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ github.token }}

run:
terratest:
runs-on: ubuntu-latest
container: cloudposse/test-harness:latest
needs: [pr, pending]
Expand Down Expand Up @@ -293,47 +293,40 @@ jobs:
-owner "${{ github.event.repository.owner.login }}"
env:
GITHUB_TOKEN: ${{ github.token }}
# finalize:
# runs-on: ubuntu-latest
# needs: [terratest]
# if: ${{ always() }}
# steps:
# - shell: bash
# id: status
# run: |
# if [[ ${{ needs.terratest.result }} == 'success' ]]; then
# echo "result=success" >> $GITHUB_OUTPUT
# elif [[ ${{ needs.terratest.result }} == 'cancelled' ]]; then
# echo "result=failure" >> $GITHUB_OUTPUT
# elif [[ ${{ needs.terratest.result }} == 'failure' ]]; then
# echo "result=failure" >> $GITHUB_OUTPUT
# elif [[ ${{ needs.terratest.result }} == 'skipped' ]]; then
# echo "result=failure" >> $GITHUB_OUTPUT
# else
# echo "Some tests failed"
# exit 1
# fi
#
# - name: "Update GitHub Status for pending"
# uses: docker://cloudposse/github-status-updater
# with:
# args: >-
# -action update_state
# -ref "${{ github.event.client_payload.pull_request.head.sha }}"
# -repo "${{ github.event.repository.name }}"
# -state ${{ steps.status.outputs.result }}
# -context "test/terratest"
# -description "Tests started by @${{ github.event.client_payload.github.actor }}"
# -url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
# -owner "${{ github.event.repository.owner.login }}"
# env:
# GITHUB_TOKEN: ${{ secrets.github_access_token }}

terratest:
runs-on: ${{ fromJSON(inputs.runs-on) }}
finalize:
runs-on: ubuntu-latest
needs: [terratest]
if: ${{ always() }}
steps:
- run: |
echo '${{ toJSON(needs) }}' # easier debug
! ${{ contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') }}
needs: [run]
- shell: bash
id: status
run: |
if [[ ${{ needs.terratest.result }} == 'success' ]]; then
echo "result=success" >> $GITHUB_OUTPUT
elif [[ ${{ needs.terratest.result }} == 'cancelled' ]]; then
echo "result=failure" >> $GITHUB_OUTPUT
elif [[ ${{ needs.terratest.result }} == 'failure' ]]; then
echo "result=failure" >> $GITHUB_OUTPUT
elif [[ ${{ needs.terratest.result }} == 'skipped' ]]; then
echo "result=failure" >> $GITHUB_OUTPUT
else
echo "Some tests failed"
exit 1
fi
- name: "Update GitHub Status for pending"
uses: docker://cloudposse/github-status-updater
with:
args: >-
-action update_state
-ref "${{ needs.pr.outputs.head }}"
-repo "${{ github.event.repository.name }}"
-state ${{ steps.status.outputs.result }}
-context "test/terratest"
-description "Tests started by @${{ github.actor }}"
-url "https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
-owner "${{ github.event.repository.owner.login }}"
env:
GITHUB_TOKEN: ${{ github.token }}

0 comments on commit a469a37

Please sign in to comment.