Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add output_type_id_datatype property to v3.0.1. Resolves #87 #88

Merged
merged 14 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/comment-diff.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: "Generate New Spec Diff"

on:
issue_comment:
types: [created]

jobs:
comment-changed-workflow:
name: 'Comment Spec Diff'
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/diff') }}
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: r-lib/actions/pr-fetch@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: "Record DIFF"
id: dl
run: |
echo "body<<EOF" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
old=$(ls -d */ | sort | tail -n 2 | head -n 1)
new=$(ls -d */ | sort | tail -n 1)
echo "Here are your diffs for this pull request" >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo '## `admin-schema.json`' >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo '```diff' >> $GITHUB_ENV
echo "$(diff -u ${old}admin-schema.json ${new}admin-schema.json)" >> $GITHUB_ENV
echo '```' >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo '## `tasks-schema.json`' >> $GITHUB_ENV
echo "" >> $GITHUB_ENV
echo '```diff' >> $GITHUB_ENV
echo "$(diff -u ${old}tasks-schema.json ${new}tasks-schema.json)" >> $GITHUB_ENV
echo '```' >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: "Comment on PR"
uses: carpentries/actions/comment-diff@5d73d6a34b013488264890868d8eeab1edffdf2e
with:
pr: ${{ github.event.issue.number }}
body: ${{ env.body }}

7 changes: 7 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# v3.0.1

* Introduction of optional `output_type_id_datatype` property to enable hub administrators to configure and communicate the `output_type_id` column data type at a hub level. This will allow hubs to override default behaviour of automatically determinining the simplest data type that can accomodate output type IDs across all output types when creating hub schema. The setting is also useful for administrators to future proof the `output_type_id` column from potential issues arising by changes in data type, introduced by new output types after submissions have begun, by setting `output_type_id_datatype` to the simplest data type from the start, i.e. character (#87).
* Removed restrictive epidemic week formatting requirements for CDF `output_type_id` values. Character output type IDs no longer need to conform to the regex pattern `^EW[0-9]{6}` (e.g. `"EW202240"`) (#80).



# v3.0.0

* Breaking change: introduction of new `sample` output type id schema specification in `tasks.json`. The main breaking change is the removal of the `output_type_id` property in `sample`. Instead, the collection of samples is defined through a new `output_type_id_params` object (#70).
Expand Down
60 changes: 60 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ The [`HubDocs`](https://hubdocs.readthedocs.io/en/latest/index.html) documentati

After making a new release to the schema repository, ensure `hubDocs` are also appropriately updated and an associated new release in the `hubDocs` repository also created.


## New schema version development process

- New schema versions should be developed in a separate branch. Name the branch `v{version-number}-branch` to avoid creating release tags which share the same name as a branch later on.
Expand All @@ -28,3 +29,62 @@ After making a new release to the schema repository, ensure `hubDocs` are also a
- Update `HubDocs` site with any additional relevant information associated with the new schema release.
- Create a new release on `hubDocs` using the same version number but without the `v` (e.g. `v0.0.1` would be released as `0.0.1` on `hubDocs`).
- Update the [`hubTemplate`](https://github.com/hubverse-org/hubTemplate) config to reflect the most up to date schema. Create a new release using the same version.


## Highlighting changes to schema in PRs

To bring attention to the changes in new schema versions, it's useful to include in any PR, a print out of the diffs in the `tasks-schema.json` and `admin-schema.json` files compared to the previous version.

### Automated Process (via GitHub)

After you create a new Pull Request, if you create a new comment with `/diff`, GitHub will automatically generate the diffs of the `tasks-schema.json` and `admin-schema.json` and comment on the pull request.

If you need to update the schema after review, you can update the diffs by creating another `/diff` comment.

If this does not work for any reason, you can follow the manual process below.

### Manual Process

To print the diffs in each file you can use the following commands in the terminal:

#### `admin-schema.json`

```bash
diff -u --color=always $(ls -d */ | sort | tail -n 2 | head -n 1)admin-schema.json $(ls -d */ | sort | tail -n 1)admin-schema.json
```
#### `tasks-schema.json`

```bash
diff -u --color=always $(ls -d */ | sort | tail -n 2 | head -n 1)tasks-schema.json $(ls -d */ | sort | tail -n 1)tasks-schema.json
```

> ### :bulb: Tips
>
> #### Show diff colours in PR
> To show the colour of the diffs in the PR, wrap the output of the commands in a `diff` code block, e.g.
>
> \```diff
> \- old line
> \+ new line
> \```
> is rendered in the PR renders as:
>
> ```diff
> - old line
> + new line
> ```
>
> #### Send output directly to clipboard
> Depending on your system (macOS or Linux), you can pipe the output of the above commands directly to the clipboard. See examples below:
>
> ##### macOS:
> ```bash
> diff $(ls -d */ | sort | tail -n 2 | head -n 1)tasks-schema.json $(ls -d */ | sort | tail -n 1)tasks-schema.json | pbcopy
>```
>
> ##### Linux:
> Make sure `xclip` is installed. You can install it using your package manager, e.g., `sudo apt-get install xclip` on Debian-based systems.
> ```bash
> diff $(ls -d */ | sort | tail -n 2 | head -n 1)tasks-schema.json $(ls -d */ | sort | tail -n 1)tasks-schema.json | xclip -selection clipboard
>```
>
Loading
Loading