@samitouri / QOS-React-2 / commits / 6d394e3d26

[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.

Jan Kassens committed Apr 19, 2023 at 12:11 UTC 6d394e3d26a1e785d0510d732eedcdd2be3e92b5
1 file changed +13 -2
.github/workflows/commit_artifacts.yml
+13 -2
@@ -1,13 +1,22 @@
1 -name: Commit Artifacts for Facebook WWW and fbsource
1 +name: Commit Artifacts for Meta WWW and fbsource
2
3 on:
4 push:
5 - branches: [main]
5 + branches: [main, meta-www, meta-fbsource]
6
7 jobs:
8 download_artifacts:
9 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 }}
13 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"
20 - name: Download and unzip artifacts
21 uses: actions/github-script@v6
22 env:
@@ -168,6 +177,7 @@ jobs:
177
178 commit_www_artifacts:
179 needs: download_artifacts
180 + if: ${{ (github.ref == 'refs/heads/main' && needs.download_artifacts.outputs.www_branch_count == '0') || github.ref == 'refs/heads/meta-www' }}
181 runs-on: ubuntu-latest
182 steps:
183 - uses: actions/checkout@v3
@@ -204,6 +214,7 @@ jobs:
214 commit_fbsource_artifacts:
215 needs: download_artifacts
216 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' }}
218 steps:
219 - uses: actions/checkout@v3
220 with: