.github/workflows/status.yml #281
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: [status] | |
jobs: | |
circleci_artifacts_redirector_status_job: | |
runs-on: ubuntu-latest | |
if: "${{ github.event.context == 'ci/circleci: build' }}" | |
name: CircleCI artifacts redirector status | |
outputs: | |
url: ${{ steps.run-circleci-artifacts-redirector.outputs.url }} | |
steps: | |
# WARNING! | |
# This repo uses the action in its own root directory. | |
# GitHub-action users should not do this! | |
# See README.md for usage instructions. | |
- name: Print event data | |
env: | |
GITHUB_EVENT: ${{ toJSON(github.event) }} | |
run: echo "$GITHUB_EVENT" | |
- name: Print expected ref | |
run: echo SHA=${{ github.event.sha }} | |
- name: Checkout repo | |
uses: actions/checkout@master | |
with: | |
ref: ${{ github.event.sha }} | |
- name: Check history | |
run: git log -n 1 | |
- name: GitHub Action step | |
uses: ./ | |
with: | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
api-token: ${{ secrets.CIRCLECI_TOKEN }} | |
artifact-path: 0/test_artifacts/root_artifact.md | |
job-title: "See artifact here (status)!" | |
id: run-circleci-artifacts-redirector | |
use_outputs_status_job: | |
runs-on: ubuntu-latest | |
needs: [circleci_artifacts_redirector_status_job] | |
name: Use the status output | |
if: github.event.state != 'pending' | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@master | |
with: | |
ref: ${{ github.event.sha }} | |
- name: Get expected commit | |
run: | | |
echo ${{ needs.circleci_artifacts_redirector_status_job.outputs.url }} | |
echo ${{ github.event.sha }} | |
- name: Check the URL | |
run: curl -L --fail ${{ needs.circleci_artifacts_redirector_status_job.outputs.url }} | grep ${{ github.event.sha }} |