Skip to content

Commit

Permalink
Try environments
Browse files Browse the repository at this point in the history
Signed-off-by: safinsaf <[email protected]>
  • Loading branch information
safinsaf committed Apr 13, 2022
1 parent 2adaa4f commit 4126e7d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 33 deletions.
29 changes: 8 additions & 21 deletions .github/build-iroha1-fork.src.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,25 @@ permissions:

## This workflow is created for pull requests from forks only and has less permissions than build-iroha1 workflow
on:
#pull_request_target:
# branches: [ main, support/1.*, edge, develop, feature/DOPS-1651/enable-fork-build ] ## target branches


issue_comment:
types: [created]
pull_request_target:
branches: [ main, support/1.*, edge, develop, feature/DOPS-1651/enable-fork-build ]
paths-ignore:
- '**.md'
- '**.rst'


env:
DOCKERHUB_ORG: hyperledger

jobs:



## This step allows to skip the workflow completely for pull_requests from the same repo
## Also it checks that that .github folder and Dockerfiles are not changed
check_if_pull_request_comes_from_fork:

runs-on: ubuntu-20.04 #ubuntu-latest
name: Pull requests from forks should use other workflow
if: ${{ github.event.issue.comment.body == "Launch build" }}
name: Pull requests from forks should use this workflow
if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:

-
name: Show context
run: |
Expand All @@ -53,13 +47,6 @@ jobs:
${{ toJson(needs) }}
END
echo "::endgroup::"
- name: Allow build
if:
run: |
"Lunching build"
- &step_checkout_head
name: Checkout head
Expand Down Expand Up @@ -94,9 +81,9 @@ jobs:

generate_matrixes:
runs-on: ubuntu-20.04 #ubuntu-latest
environment: test-env
runs-on: ubuntu-20.04
needs: check_if_pull_request_comes_from_fork
#container: ubuntu:latest
if: ${{ (github.event_name != 'comment') || ( github.event.comment &&
github.event.issue.pull_request &&
startsWith(github.event.comment.body, '/build') ) }}
Expand Down
20 changes: 8 additions & 12 deletions .github/workflows/build-iroha1-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ permissions:
statuses: read
## This workflow is created for pull requests from forks only and has less permissions than build-iroha1 workflow
on:
#pull_request_target:
# branches: [ main, support/1.*, edge, develop, feature/DOPS-1651/enable-fork-build ] ## target branches
issue_comment:
types: [created]
pull_request_target:
branches: [main, support/1.*, edge, develop, feature/DOPS-1651/enable-fork-build]
paths-ignore:
- '**.md'
- '**.rst'
env:
DOCKERHUB_ORG: hyperledger
jobs:
## This step allows to skip the workflow completely for pull_requests from the same repo
## Also it checks that that .github folder and Dockerfiles are not changed
check_if_pull_request_comes_from_fork:
runs-on: ubuntu-20.04 #ubuntu-latest
name: Pull requests from forks should use other workflow
if: ${{ github.event.issue.comment.body == "Launch build" }}
name: Pull requests from forks should use this workflow
if: github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
steps:
- name: Show context
run: |
Expand All @@ -43,10 +43,6 @@ jobs:
${{ toJson(needs) }}
END
echo "::endgroup::"
- name: Allow build
if:
run: |
"Lunching build"
- name: Checkout head
uses: actions/checkout@v2
with:
Expand Down Expand Up @@ -74,9 +70,9 @@ jobs:
echo "Pull requests from forks are not allowed to change Dockerfiles"
false
generate_matrixes:
runs-on: ubuntu-20.04 #ubuntu-latest
environment: test-env
runs-on: ubuntu-20.04
needs: check_if_pull_request_comes_from_fork
#container: ubuntu:latest
if: ${{ (github.event_name != 'comment') || ( github.event.comment && github.event.issue.pull_request && startsWith(github.event.comment.body, '/build') ) }}
steps:
- name: Show context
Expand Down

0 comments on commit 4126e7d

Please sign in to comment.