From 6d394e3d26a1e785d0510d732eedcdd2be3e92b5 Mon Sep 17 00:00:00 2001 From: Jan Kassens Date: Wed, 19 Apr 2023 12:11:40 -0400 Subject: [PATCH] [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. --- .github/workflows/commit_artifacts.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/commit_artifacts.yml b/.github/workflows/commit_artifacts.yml index fe6da85658..11676a0dc0 100644 --- a/.github/workflows/commit_artifacts.yml +++ b/.github/workflows/commit_artifacts.yml @@ -1,13 +1,22 @@ -name: Commit Artifacts for Facebook WWW and fbsource +name: Commit Artifacts for Meta WWW and fbsource on: push: - branches: [main] + branches: [main, meta-www, meta-fbsource] jobs: download_artifacts: runs-on: ubuntu-latest + outputs: + www_branch_count: ${{ steps.check_branches.outputs.www_branch_count }} + fbsource_branch_count: ${{ steps.check_branches.outputs.fbsource_branch_count }} steps: + - uses: actions/checkout@v3 + - name: "Check branches" + id: check_branches + run: | + echo "www_branch_count=$(git ls-remote --heads origin "refs/heads/meta-www" | wc -l)" >> "$GITHUB_OUTPUT" + echo "fbsource_branch_count=$(git ls-remote --heads origin "refs/heads/meta-fbsource" | wc -l)" >> "$GITHUB_OUTPUT" - name: Download and unzip artifacts uses: actions/github-script@v6 env: @@ -168,6 +177,7 @@ jobs: commit_www_artifacts: needs: download_artifacts + if: ${{ (github.ref == 'refs/heads/main' && needs.download_artifacts.outputs.www_branch_count == '0') || github.ref == 'refs/heads/meta-www' }} runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -204,6 +214,7 @@ jobs: commit_fbsource_artifacts: needs: download_artifacts runs-on: ubuntu-latest + if: ${{ (github.ref == 'refs/heads/main' && needs.download_artifacts.outputs.fbsource_branch_count == '0') || github.ref == 'refs/heads/meta-fbsource' }} steps: - uses: actions/checkout@v3 with: