Skip to content

Commit 70bda41

Browse files
committed
[actions] commit from special branches iff they exist (#26673)
This creates 2 special branches. If these special branches exist, we'll commit build artifacts from these branches, main otherwise.
1 parent d8dfc22 commit 70bda41

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

.github/workflows/commit_artifacts.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
1-
name: Commit Artifacts for Facebook WWW and fbsource
1+
name: Commit Artifacts for Meta WWW and fbsource
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, meta-www, meta-fbsource]
66

77
jobs:
88
download_artifacts:
99
runs-on: ubuntu-latest
10+
outputs:
11+
www_branch_count: ${{ steps.check_branches.outputs.www_branch_count }}
12+
fbsource_branch_count: ${{ steps.check_branches.outputs.fbsource_branch_count }}
1013
steps:
14+
- uses: actions/checkout@v3
15+
- name: "Check branches"
16+
id: check_branches
17+
run: |
18+
echo "www_branch_count=$(git ls-remote --heads origin "refs/heads/meta-www" | wc -l)" >> "$GITHUB_OUTPUT"
19+
echo "fbsource_branch_count=$(git ls-remote --heads origin "refs/heads/meta-fbsource" | wc -l)" >> "$GITHUB_OUTPUT"
1120
- name: Download and unzip artifacts
1221
uses: actions/github-script@v6
1322
env:
@@ -168,6 +177,7 @@ jobs:
168177

169178
commit_www_artifacts:
170179
needs: download_artifacts
180+
if: ${{ (github.ref == 'refs/heads/main' && needs.download_artifacts.outputs.www_branch_count == '0') || github.ref == 'refs/heads/meta-www' }}
171181
runs-on: ubuntu-latest
172182
steps:
173183
- uses: actions/checkout@v3
@@ -204,6 +214,7 @@ jobs:
204214
commit_fbsource_artifacts:
205215
needs: download_artifacts
206216
runs-on: ubuntu-latest
217+
if: ${{ (github.ref == 'refs/heads/main' && needs.download_artifacts.outputs.fbsource_branch_count == '0') || github.ref == 'refs/heads/meta-fbsource' }}
207218
steps:
208219
- uses: actions/checkout@v3
209220
with:

0 commit comments

Comments
 (0)