scientific-python / circleci-artifacts-redirector-action

GitHub Action to add a GitHub status link to a CircleCI artifact.
MIT License
14 stars 8 forks source link

circleci-artifacts-redirector-action

GitHub Action to add a GitHub status link to a CircleCI artifact.

Example usage

Sample .github/workflows/main.yml:

on: [status]

permissions: read-all

jobs:
  circleci_artifacts_redirector_job:
    runs-on: ubuntu-latest
    if: "${{ github.event.context == 'ci/circleci: build_doc' }}"
    permissions:
      statuses: write
    name: Run CircleCI artifacts redirector
    steps:
      - name: GitHub Action step
        id: step1
        uses: scientific-python/circleci-artifacts-redirector-action@v1
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          api-token: ${{ secrets.CIRCLECI_TOKEN }}
          artifact-path: 0/test_artifacts/root_artifact.md
          circleci-jobs: build_doc
          job-title: Check the rendered docs here!
      - name: Check the URL
        if: github.event.status != 'pending'
        run: |
          curl --fail ${{ steps.step1.outputs.url }} | grep $GITHUB_SHA

Note: The standard PR-to-main-repo-from-branch-in-a-fork workflow might not activate the action. For changes to take effect, changes might need to be made to to the default branch in a repo with the action enabled. For example, you could iterate directly in master, or in master of a fork. This seems to be a limitation of the fact that CircleCI uses the status (rather than app) API and that this is always tied to the master/default branch of a given repository.

Limitations

Currently has (known) limitations:

Eventually this might be fixable by a bit of work and addition of customization options.

Contributing

Make sure you have done npm install to get all dependencies and used ncc build index.js before committing and opening a PR. On Ubuntu you might need to export NODE_OPTIONS=--openssl-legacy-provider before the ncc build step.