-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 35a2e6a
Showing
15 changed files
with
629 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Dataset Initialiation | ||
|
||
Thanks for creating this new dataset, to be fully completed the following steps are required: | ||
|
||
- [ ] Update README.md | ||
- [ ] Define LICENCES | ||
- [ ] Generate a metadata entry form | ||
- [ ] Should this dataset be available via: | ||
- [ ] ERDDAP | ||
- [ ] OBIS | ||
- [ ] Can this repository be public? | ||
- [ ] Should this repository be archived in a global repository. |
5 changes: 5 additions & 0 deletions
5
.github/PULL_REQUEST_TEMPLATE/production-merge-pull-request-body.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Add latest changes to production branch | ||
|
||
This Pull request is automatically generated from the main branch to the production branch. If no issues are detected the pull request will be automatically merged into the production branch. | ||
|
||
Any tests failure will prevent this pull request from being merged into the production branch. Please correct the issues detected by the tests action. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Create initialization issue on repository dispatch | ||
on: | ||
push: | ||
branches: main | ||
|
||
jobs: | ||
create_issue: | ||
runs-on: ubuntu-latest | ||
if: ${{ github.repository != 'HakaiInstitute/hakai-dataset-repository-template' }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Create issue | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{secrets.CI_TOKEN}} | ||
script: | | ||
const fs = require('fs') | ||
const org = 'HakaiInstitute' | ||
const team_slug = 'data-mobilization-team' | ||
const teamMembers = await github.rest.teams.listMembersInOrg({ | ||
org, | ||
team_slug, | ||
}) | ||
const reviewer = teamMembers.data.map(member => member.login) | ||
// Read the issue body from a file | ||
const issueBody = fs.readFileSync('.github/ISSUE_TEMPLATE/init-data-repository-body.md', 'utf8') | ||
const issue = { | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
title: 'Initialize dataset repository', | ||
body: issueBody, | ||
assignees: reviewer, | ||
} | ||
github.rest.issues.create(issue) | ||
- name: Cleanup repository initialization files | ||
run: | | ||
rm -rf .github/workflows/init-dataset-repo.yaml | ||
rm -rf .github/ISSUE_TEMPLATE/init-data-repository-body.md | ||
sed -i 's|# hakai-dataset-repository-template|# ${{ github.repository }}|g' README.md | ||
- name: Change CODEOWNER to github actor | ||
run: | | ||
echo "* @$GITHUB_ACTOR" > CODEOWNERS | ||
- name: Commit and push changes | ||
uses: stefanzweifel/git-auto-commit-action@v5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Test data and merge to production | ||
on: | ||
push: | ||
branches: main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }} | ||
MERGE_FROM_BRANCH: main | ||
MERGE_TO_BRANCH: production | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Install Hakai Tests | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install git+https://HakaiInstitute:[email protected]/HakaiInstitute/hakai-datasets-repo-standard-tests.git | ||
- name: Test with pytest | ||
run: | | ||
pytest --pyargs hakai_data_repo_tests | ||
production-merge: | ||
runs-on: ubuntu-latest | ||
env: | ||
PR_STATUS: '' | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set PR status as environment variable | ||
run: | | ||
echo 'PR_STATUS<<EOF' >> $GITHUB_ENV | ||
gh pr status >> $GITHUB_ENV | ||
echo 'EOF' >> $GITHUB_ENV | ||
- name: Create MERGE_TO_BRANCH if it does not exist | ||
run: | | ||
git checkout -b ${{env.MERGE_TO_BRANCH}} | ||
git push origin ${{env.MERGE_TO_BRANCH}} | ||
- name: Compare branches and save to environment variable | ||
run: | | ||
git fetch origin ${{env.MERGE_FROM_BRANCH}} | ||
git fetch origin ${{env.MERGE_TO_BRANCH}} | ||
BRANCHES_DIFF=$(git diff --name-only origin/${{env.MERGE_FROM_BRANCH}} origin/${{env.MERGE_TO_BRANCH}}) | ||
echo "BRANCHES_DIFF<<EOF" >> $GITHUB_ENV | ||
echo $BRANCHES_DIFF >> $GITHUB_ENV | ||
echo "EOF" >> $GITHUB_ENV | ||
- name: Create Pull Request if there are changes | ||
if: ${{contains(env.PR_STATUS, 'There is no pull request associated with [main]')}} && ${{env.BRANCHES_DIFF != ''}} | ||
run: | | ||
gh pr create \ | ||
-H ${{env.MERGE_FROM_BRANCH}} \ | ||
-B ${{env.MERGE_TO_BRANCH}} \ | ||
--title "Merge latest changes to main into production branch" \ | ||
--body-file ".github/PULL_REQUEST_TEMPLATE/production-merge-pull-request-body.md" | ||
merge: | ||
runs-on: ubuntu-latest | ||
needs: [tests, production-merge] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Auto-merge pull requests | ||
run: gh pr merge --auto --merge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Test dataset | ||
|
||
on: | ||
pull_request: | ||
branches: main | ||
|
||
jobs: | ||
tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.11' | ||
- name: Install Hakai Tests | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install git+https://HakaiInstitute:${{secrets.CI_TOKEN}}@github.com/HakaiInstitute/hakai-datasets-repo-standard-tests.git | ||
- name: Test with pytest | ||
run: | | ||
pytest --pyargs hakai_data_repo_tests |
15 changes: 15 additions & 0 deletions
15
.github/workflows/update-hakai-server-with-production.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Tell Hakai servers to update dataset | ||
on: | ||
push: | ||
branches: production | ||
|
||
jobs: | ||
tell-server-to-pull: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Repository Dispatch | ||
uses: peter-evans/repository-dispatch@v2 | ||
with: | ||
token: ${{ secrets.CI_TOKEN }} | ||
repository: HakaiInstitute/hakai-dataset-repositories-harvester | ||
event-type: pull-all-datasets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* @hakaiinstitute/data-mobilization-team |
Oops, something went wrong.