|
| 1 | +name: Examples |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + |
| 6 | +concurrency: |
| 7 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 8 | + cancel-in-progress: true |
| 9 | + |
| 10 | +jobs: |
| 11 | + # NOTE: github.event.head_commit.message is not available on pull_request events |
| 12 | + head-commit: |
| 13 | + name: Inspect head commit |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + message: ${{ steps.commit.outputs.message }} |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + ref: ${{github.event.pull_request.head.sha}} |
| 22 | + - name: Inspect |
| 23 | + id: commit |
| 24 | + run: echo "message=$(git show -s --format=%s)" >> "$GITHUB_OUTPUT" |
| 25 | + |
| 26 | + convert: |
| 27 | + needs: [head-commit] |
| 28 | + if: "${{needs.head-commit.outputs.message != 'docs(examples): converted from e2es'}}" |
| 29 | + strategy: |
| 30 | + matrix: |
| 31 | + e2e: |
| 32 | + - extra-fields |
| 33 | + - federation-example |
| 34 | + - federation-mixed |
| 35 | + - file-upload |
| 36 | + - apq-subgraphs |
| 37 | + - federation-subscriptions-passthrough |
| 38 | + - hmac-auth-https |
| 39 | + - interface-additional-resolvers |
| 40 | + - json-schema-subscriptions |
| 41 | + - openapi-additional-resolvers |
| 42 | + - openapi-arg-rename |
| 43 | + - openapi-javascript-wiki |
| 44 | + - openapi-subscriptions |
| 45 | + - programmatic-batching |
| 46 | + - subscriptions-with-transforms |
| 47 | + - type-merging-batching |
| 48 | + name: Convert ${{matrix.e2e}} |
| 49 | + runs-on: ubuntu-latest |
| 50 | + steps: |
| 51 | + - name: Checkout |
| 52 | + uses: actions/checkout@v4 |
| 53 | + - name: Set up env |
| 54 | + uses: the-guild-org/shared-config/setup@v1 |
| 55 | + - name: Convert |
| 56 | + run: yarn workspace @internal/examples run start ${{matrix.e2e}} true |
| 57 | + - name: Upload |
| 58 | + uses: actions/upload-artifact@v4 |
| 59 | + with: |
| 60 | + name: example-${{matrix.e2e}} |
| 61 | + # include all files and folders starting with a dot (.) |
| 62 | + include-hidden-files: true |
| 63 | + # > If multiple paths are provided as input, the least common ancestor of all the search paths will be used as the root directory of the artifact. |
| 64 | + # https://github.com/actions/upload-artifact#upload-using-multiple-paths-and-exclusions |
| 65 | + # |
| 66 | + # Because of this, we include the root README.md to maintain the paths during artifact downloads |
| 67 | + path: | |
| 68 | + README.md |
| 69 | + examples/${{matrix.e2e}} |
| 70 | + !examples/${{matrix.e2e}}/node_modules |
| 71 | +
|
| 72 | + commit: |
| 73 | + needs: [convert] |
| 74 | + name: Commit |
| 75 | + runs-on: ubuntu-latest |
| 76 | + steps: |
| 77 | + - name: Checkout |
| 78 | + uses: actions/checkout@v4 |
| 79 | + with: |
| 80 | + token: ${{secrets.BOT_GITHUB_TOKEN}} |
| 81 | + - name: Download |
| 82 | + uses: actions/download-artifact@v4 |
| 83 | + with: |
| 84 | + pattern: example-* |
| 85 | + merge-multiple: true |
| 86 | + - name: Diff |
| 87 | + run: git diff --pretty |
| 88 | + - name: Commit |
| 89 | + uses: stefanzweifel/git-auto-commit-action@v5 |
| 90 | + with: |
| 91 | + file_pattern: examples/ |
| 92 | + commit_message: 'docs(examples): converted from e2es' |
| 93 | + commit_user_name: theguild-bot |
| 94 | + commit_user_email: [email protected] |
| 95 | + commit_author: theguild-bot <[email protected]> # dont use the actor as an author |
0 commit comments