Skip to content

Commit bb00093

Browse files
authored
Merge pull request 0xPolygon#749 from 0xPolygon/hosted/fix_trigger_issues
Fix for hosted deployment branch
2 parents f16705b + 1b69b71 commit bb00093

File tree

2 files changed

+4
-69
lines changed

2 files changed

+4
-69
lines changed

.github/workflows/build_and_deploy.yml

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -32,75 +32,9 @@ on:
3232
default: "frontend-dev-ecs-cluster"
3333

3434
jobs:
35-
check_files_changed:
36-
runs-on: ubuntu-latest
37-
environment: ${{ inputs.environment }}
38-
permissions:
39-
id-token: write
40-
contents: write
41-
outputs:
42-
FILES_CHANGED: ${{ steps.changes.outputs.FILES_CHANGED }}
43-
steps:
44-
- name: Install GitHub CLI
45-
run: |
46-
(type -p wget >/dev/null || (sudo apt update && sudo apt-get install wget -y)) \
47-
&& sudo mkdir -p -m 755 /etc/apt/keyrings \
48-
&& wget -qO- https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo tee /etc/apt/keyrings/githubcli-archive-keyring.gpg > /dev/null \
49-
&& sudo chmod go+r /etc/apt/keyrings/githubcli-archive-keyring.gpg \
50-
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
51-
&& sudo apt update \
52-
&& sudo apt install gh -y
53-
54-
- name: Authenticate GitHub CLI
55-
run: gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}"
56-
57-
- name: Checkout Code Repository
58-
uses: actions/checkout@v3
59-
with:
60-
fetch-depth: 2
61-
62-
- name: Get list of changed files
63-
id: changes
64-
run: |
65-
changed_files=$(git diff --name-only HEAD^ HEAD)
66-
num_changed_files=$(echo "$changed_files" | wc -l)
67-
echo "Number of Files changed=$num_changed_files"
68-
echo "FILES_CHANGED=$num_changed_files" >> "$GITHUB_OUTPUT"
69-
70-
check_pr_open:
71-
runs-on: ubuntu-latest
72-
environment: ${{ inputs.environment }}
73-
needs: [check_files_changed]
74-
if: needs.check_files_changed.outputs.FILES_CHANGED != '' && startsWith(github.head_ref, 'hosted/')
75-
permissions:
76-
id-token: write
77-
contents: write
78-
outputs:
79-
PR_OPEN: ${{ steps.check_pr.outputs.PR_OPEN }}
80-
steps:
81-
- name: Checkout Code Repository
82-
uses: actions/checkout@v3
83-
with:
84-
fetch-depth: 1
85-
86-
- name: Check for open PR
87-
id: check_pr
88-
run: |
89-
BRANCH_NAME=${{ github.head_ref }}
90-
pr_number=$(gh pr list --head "$BRANCH_NAME" --state open --json number --jq '.[0].number')
91-
echo "Checked PR number: $pr_number"
92-
echo "PR_OPEN=$pr_number" >> "$GITHUB_OUTPUT"
93-
env:
94-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95-
9635
build_and_deploy:
9736
runs-on: ubuntu-latest
98-
environment: ${{ inputs.environment }}
99-
needs: [check_files_changed, check_pr_open]
100-
if: |
101-
needs.check_files_changed.outputs.FILES_CHANGED != '' && github.ref == 'refs/heads/dev' ||
102-
needs.check_pr_open.outputs.PR_OPEN != '' && needs.check_files_changed.outputs.FILES_CHANGED != '' &&
103-
startsWith(github.head_ref, 'hosted/')
37+
environment: ${{ inputs.environment }}
10438
permissions:
10539
id-token: write
10640
contents: write
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
name: Hosted PR and Dev Deployment
22
on:
33
pull_request:
4-
types: [opened, edited, reopened, synchronize]
4+
types: [opened, reopened, synchronize]
55
push:
66
branches:
77
- dev
88
workflow_dispatch:
99

1010
jobs:
1111
deploy:
12+
if: github.event_name == 'push' || startsWith(github.head_ref, 'hosted/')
1213
uses: ./.github/workflows/build_and_deploy.yml
13-
secrets: inherit
14+
secrets: inherit

0 commit comments

Comments
 (0)