|
| 1 | +--- |
| 2 | +name: Generate PNG Samples |
| 3 | + |
| 4 | +# yamllint disable rule:truthy |
| 5 | +on: |
| 6 | + push: |
| 7 | + tags: |
| 8 | + - '*' |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +jobs: |
| 12 | + generate-samples: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Setup Python |
| 16 | + uses: actions/setup-python@v4 |
| 17 | + with: |
| 18 | + python-version: '3.11' |
| 19 | + |
| 20 | + - name: Setup Poetry |
| 21 | + uses: abatilo/actions-poetry@v2 |
| 22 | + with: |
| 23 | + poetry-version: 1.4.2 |
| 24 | + |
| 25 | + - name: Checkout |
| 26 | + uses: actions/checkout@v3 |
| 27 | + |
| 28 | + - name: Get JSON |
| 29 | + shell: bash |
| 30 | + run: | |
| 31 | + make grab-some-scripts |
| 32 | +
|
| 33 | + - name: Generate samples |
| 34 | + shell: bash |
| 35 | + env: |
| 36 | + BOTC_PDF2IMAGE: yes-please |
| 37 | + run: | |
| 38 | + sudo apt-get install -y poppler-utils |
| 39 | + make all-scripts |
| 40 | +
|
| 41 | + # and eventually we'll create a PR for this |
| 42 | + # but we need to make sure we don't end up in a loop |
| 43 | + # of generate -> new version -> generate -> new version ... |
| 44 | + |
| 45 | + - name: Create Pull Request |
| 46 | + id: cpr |
| 47 | + uses: peter-evans/create-pull-request@v4 |
| 48 | + with: |
| 49 | + title: Regenerate PNG sample images [auto-generated] |
| 50 | + # add some labels |
| 51 | + labels: automatic-pr, generate-pngs |
| 52 | + # this is the name of the branch created to hold the changes for the |
| 53 | + # PR |
| 54 | + branch: generate-pngs/${{ github.sha }} |
| 55 | + # just to be extra safe we specify that we want to merge into the |
| 56 | + # default branch |
| 57 | + base: ${{ github.event.repository.default_branch }} |
| 58 | + # no need to keep the branch around after the PR is merged |
| 59 | + delete-branch: true |
| 60 | + # ignore any (accidental?) changes outside of the user_access/ dir |
| 61 | + add-paths: | |
| 62 | + generated/ |
| 63 | + # yamllint disable-line rule:line-length |
| 64 | + # https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow |
| 65 | + token: ${{ secrets.CHISEL_GITHUB_TOKEN }} |
| 66 | + |
| 67 | + - name: Check outputs |
| 68 | + if: ${{ steps.cpr.outputs.pull-request-number }} |
| 69 | + # yamllint disable rule:line-length |
| 70 | + run: | |
| 71 | + echo "::notice::Pull Request Created - ${{ steps.cpr.outputs.pull-request-url }}" |
| 72 | + # yamllint enable rule:line-length |
0 commit comments