diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6e595c0..ff33c18 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,21 +6,23 @@ jobs: test: runs-on: ubuntu-latest steps: - - run: | - echo "Build with Ref Saved" - # - name: Save base ref info - # run: | - # BASE="${{ github.base_ref }}" - # CURRENT_BRANCH="${{ github.head_ref }}" - # echo $BASE > base.txt - # echo $CURRENT_BRANCH > current-branch.txt - # cat base.txt - # cat current-branch.txt - # - name: Upload base ref info - # uses: actions/upload-artifact@v3 - # with: - # name: original-refs - # path: | - # base.txt - # current-branch.txt - # retention-days: 1 + - uses: actions/checkout@v3 + - name: Save base ref info + run: | + BASE="${{ github.base_ref }}" + CURRENT_BRANCH="${{ github.head_ref }}" + echo "${BASE}" > base.txt + echo "${CURRENT_BRANCH}" > current-branch.txt + echo "${GITHUB_SHA::7}" > github-sha.txt + cat base.txt + cat current-branch.txt + cat github-sha.txt + - name: Upload base ref info + uses: actions/upload-artifact@v3 + with: + name: original-refs + path: | + base.txt + current-branch.txt + github-sha.txt + retention-days: 1 diff --git a/.github/workflows/deploy-after-build.yml b/.github/workflows/deploy-after-build.yml index 8fe8c7d..f39c72c 100644 --- a/.github/workflows/deploy-after-build.yml +++ b/.github/workflows/deploy-after-build.yml @@ -9,23 +9,23 @@ jobs: runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'success' }} steps: - - run: | - echo "Deploy After Merged" - # - name: Download a single artifact - # uses: dawidd6/action-download-artifact@v2 - # with: - # workflow: build.yml - # name: original-refs - # workflow_conclusion: success - # - name: set REF_BASE to env - # run: | - # { - # echo "BASE=$(cat base.txt)" - # echo "CURRENT_BRANCH=$(cat current-branch.txt)" - # } >> $GITHUB_ENV - # echo "${{ toJSON(env) }}" - # - name: echo github.event.workflow_run - # run: echo "${{ toJSON(github.event.workflow_run) }}" + - name: Download a single artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: build.yml + name: original-refs + workflow_conclusion: success + - name: set REF_BASE to env + run: | + { + echo "BASE=$(cat base.txt)" + echo "CURRENT_BRANCH=$(cat current-branch.txt)" + echo "GITHUB_SHA_SHORTEN=$(cat github-sha.txt)" + } >> $GITHUB_ENV + - name: echo env + run: echo "${{ toJSON(env) }}" + - name: echo github.event.workflow_run + run: echo "${{ toJSON(github.event.workflow_run) }}" # dump: # runs-on: ubuntu-latest # steps: diff --git a/.github/workflows/first-action.yml b/.github/workflows/first-action.yml deleted file mode 100644 index 63ec8dc..0000000 --- a/.github/workflows/first-action.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: "First action" -on: - pull_request: - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - name: Save base ref info - run: | - BASE=${{ github.base_ref }} - CURRENT_BRANCH=${{ github.head_ref }} - echo $BASE > base.txt - echo $CURRENT_BRANCH > current-branch.txt - echo "${GITHUB_SHA::7}" > github-sha.txt - cat base.txt - cat current-branch.txt - cat github-sha.txt - - name: Upload base ref info - uses: actions/upload-artifact@v3 - with: - name: original-refs - path: | - base.txt - current-branch.txt - github-sha.txt - retention-days: 1 diff --git a/.github/workflows/second-action.yml b/.github/workflows/second-action.yml deleted file mode 100644 index 96cff91..0000000 --- a/.github/workflows/second-action.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: "Second action" -on: - workflow_run: - workflows: ["Link action"] - types: [completed] - -jobs: - test: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - name: Download a single artifact - uses: dawidd6/action-download-artifact@v2 - with: - workflow: first-action.yml - name: original-refs - workflow_conclusion: success - - name: set REF_BASE to env - run: | - { - echo "BASE=$(cat base.txt)" - echo "CURRENT_BRANCH=$(cat current-branch.txt)" - echo "GITHUB_SHA_SHORTEN=$(cat github-sha.txt)" - } >> $GITHUB_ENV - - name: echo env - run: echo "${{ toJSON(env) }}" - - name: echo github.event.workflow_run - run: echo "${{ toJSON(github.event.workflow_run) }}" - dump: - runs-on: ubuntu-latest - steps: - - - name: Dump context - uses: crazy-max/ghaction-dump-context@v2