diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 70ee900..2179ca0 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -60,23 +60,31 @@ jobs: tags: ghcr.io/${{ github.repository }}:${{ github.sha }} labels: ${{ steps.docker_meta_img.outputs.labels }} - branch_name: + branch_meta: runs-on: ubuntu-latest outputs: - branch: ${{ steps.extract_branch.outputs.branch }} + branch: ${{ steps.extract_branch_meta.outputs.branch }} + sha: ${{ steps.extract_branch_meta.outputs.sha }} steps: - - name: Extract branch name + - name: Extract branch meta shell: bash - run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT - id: extract_branch + id: extract_branch_meta + run: | + if [ "${{ github.event_name }}" == 'pull_request' ]; then + echo "branch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT + echo "sha=${{ github.event.pull_request.head.sha }}" >> $GITHUB_OUTPUT + else + echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT + echo "sha=${{ github.sha }}" >> $GITHUB_OUTPUT + fi deploy: needs: - build_and_push - - branch_name + - branch_meta uses: hpi-schul-cloud/dof_app_deploy/.github/workflows/deploy.yml@bc-6130 with: - branch: ${{ needs.branch_name.outputs.branch }} + branch: ${{ needs.branch_meta.outputs.branch }} secrets: token: ${{ secrets.GITHUB_TOKEN }} DEV_VAULT_BRB: ${{ secrets.DEV_VAULT_BRB }} @@ -98,7 +106,6 @@ jobs: trivy-vulnerability-scanning: needs: - build_and_push - - branch_name runs-on: ubuntu-latest permissions: actions: read