Skip to content

Commit

Permalink
Merge pull request #10 from sodadata/nonpr
Browse files Browse the repository at this point in the history
Set proper job metadata when run on non-pr branch
  • Loading branch information
gregkaczan authored Aug 16, 2023
2 parents eed4058 + b8de1ee commit 65aaefd
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- main
- nonpr
pull_request:
workflow_dispatch:

Expand Down
23 changes: 17 additions & 6 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,24 @@ runs:

# 2. Need to expand the environment variables to pass to the docker run command
# as these variables can be configured in the workflow file and contain secrets etc.
- name: Expand environment variables
id: expand_envs
- name: Set job related envs for PR
if: ${{ github.event_name == 'pull_request' }}
env:
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_URL: ${{ github.event.pull_request.html_url }}
PR_NUMBER: ${{ github.event.pull_request.number }}
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_URL: ${{ github.event.pull_request.html_url }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
env > .env_file
shell: bash

- name: Set job related envs for non-PR
if: ${{ github.event_name != 'pull_request' }}
env:
BRANCH_NAME: ${{ github.ref_name }}
PR_TITLE: ${{ github.event.head_commit.message }}
PR_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
PR_NUMBER: false
run: |
env > .env_file
shell: bash
Expand Down

0 comments on commit 65aaefd

Please sign in to comment.