diff --git a/.github/workflows/update-standard.yml b/.github/workflows/update-standard.yml index 466c674..59591ea 100644 --- a/.github/workflows/update-standard.yml +++ b/.github/workflows/update-standard.yml @@ -35,11 +35,13 @@ jobs: with: name: new_standard path: dicom_standard/dist/* - test-and-commit: + test-and-open-pr: needs: make - name: Run tox and commit to master + name: Run tox and open a pull request runs-on: ubuntu-latest - continue-on-error: true + permissions: + contents: write + pull-requests: write steps: - uses: actions/checkout@v4 - name: Set up Python ${{ env.PYTHON_VERSION }} @@ -66,9 +68,22 @@ jobs: if: steps.diff_files.outputs.diff_lines > 0 - name: Run tests run: tox - # temporary disable "publish to master", which may commit the changes in an unapproved PR - # - name: Publish to master - # uses: mikeal/publish-to-github-action@master - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # if: success() && steps.diff_files.outputs.diff_lines > 0 + # Publish via a pull request rather than by committing straight to master, so + # regenerated data is reviewed before it lands. Runs only after tox has passed. + - name: Open pull request + if: steps.diff_files.outputs.diff_lines > 0 + uses: peter-evans/create-pull-request@v8 + with: + token: ${{ secrets.GITHUB_TOKEN }} + base: master + branch: update-standard/${{ env.DICOM_VERSION }} + delete-branch: true + add-paths: standard/*.json + commit-message: 'Update standard to latest published revision' + title: 'Update standard (DICOM ${{ env.DICOM_VERSION }})' + body: | + Automated regeneration of `standard/*.json` from the current published + DICOM Standard, opened by the `update-standard` workflow. + + The test suite (`tox`) passed against this data before the pull request + was created. Review the diff and merge to publish.