From 64efe3dc30d3a817e4c7eec7276b75c6c0512400 Mon Sep 17 00:00:00 2001 From: aditigopalan <63365451+aditigopalan@users.noreply.github.com> Date: Mon, 22 Jul 2024 12:17:46 -0400 Subject: [PATCH 1/5] Add action to build dependencies table --- .../workflows/build-dependencies-table.yml | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/build-dependencies-table.yml diff --git a/.github/workflows/build-dependencies-table.yml b/.github/workflows/build-dependencies-table.yml new file mode 100644 index 00000000..ea3de022 --- /dev/null +++ b/.github/workflows/build-dependencies-table.yml @@ -0,0 +1,61 @@ +name: Build Dependencies Table + +on: + release: + types: [published] + +jobs: + update-table: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install requests pandas + + - name: Fetch attribute table + run: | + python - < Date: Mon, 22 Jul 2024 12:33:48 -0400 Subject: [PATCH 2/5] Update build-dependencies-table.yml --- .github/workflows/build-dependencies-table.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-dependencies-table.yml b/.github/workflows/build-dependencies-table.yml index ea3de022..cb827a90 100644 --- a/.github/workflows/build-dependencies-table.yml +++ b/.github/workflows/build-dependencies-table.yml @@ -52,7 +52,7 @@ jobs: git commit -m "Update HTAN.dependencies.csv with the latest attribute table" - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: aditigopalan/create-pull-request@v3 with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: "Update HTAN.dependencies.csv" From d72165e133056523fae14b35cec5c62a31f1d1d8 Mon Sep 17 00:00:00 2001 From: Aditi <63365451+aditigopalan@users.noreply.github.com> Date: Mon, 22 Jul 2024 16:01:40 -0400 Subject: [PATCH 3/5] Update ci-lint-validate-convert.yml Changes: 1. Added the build-dependencies job, which depends on the convert job. 2. Integrated the original steps for building the dependencies table into this new job. 3. Added a "Fetch latest changes" step in the build-dependencies job to ensure it pulls the latest changes from the main branch, including the newly created JSON-LD file. --- .../workflows/ci-lint-validate-convert.yml | 93 ++++++++++++++++--- 1 file changed, 78 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci-lint-validate-convert.yml b/.github/workflows/ci-lint-validate-convert.yml index a2a86e90..c2308582 100644 --- a/.github/workflows/ci-lint-validate-convert.yml +++ b/.github/workflows/ci-lint-validate-convert.yml @@ -1,20 +1,15 @@ -name: Make JSON-LD +name: Make JSON-LD and Build Dependencies Table on: pull_request: branches: 'main' paths: 'HTAN.model.csv' + release: + types: [published] workflow_dispatch: concurrency: -# cancel the current running workflow from the same branch, PR when a new workflow is triggered -# when the trigger is not a PR but a push, it will use the commit sha to generate the concurrency group -# {{ github.workflow }}: the workflow name is used to generate the concurrency group. This allows you to have more than one workflows -# {{ github.ref_type }}: the type of Git ref object created in the repository. Can be either branch or tag -# {{ github.sha }}: full commit sha -# credit: https://github.com/Sage-Bionetworks-Workflows/sagetasks/blob/main/.github/workflows/ci.yml - group: >- - ${{ github.workflow }}-${{ github.ref_type }}-${{ github.sha }} + group: ${{ github.workflow }}-${{ github.ref_type }}-${{ github.sha }} cancel-in-progress: true env: @@ -27,11 +22,11 @@ jobs: if: always() runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - name: csvlinter - uses: kcheriyath/csvlinter@V0.6.0 - with: - find_pattern: "*.csv" + - uses: actions/checkout@v4 + - name: csvlinter + uses: kcheriyath/csvlinter@V0.6.0 + with: + find_pattern: "*.csv" validate: name: Validate CSV @@ -87,7 +82,6 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Commit the changes run: | - # Specifying the full email allows the avatar to show up: https://github.com/orgs/community/discussions/26560 git add HTAN.model.jsonld git commit -m "GitHub Action: convert *.model.csv to *.model.jsonld" || echo "No changes to commit" - name: Push changes back to PR @@ -95,3 +89,72 @@ jobs: uses: r-lib/actions/pr-push@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} + + build-dependencies: + name: Build Dependencies Table + needs: convert + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Fetch latest changes + run: git pull origin main + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install requests pandas + + - name: Fetch attribute table + run: | + python - < Date: Mon, 22 Jul 2024 16:02:42 -0400 Subject: [PATCH 4/5] Update ci-lint-validate-convert.yml --- .github/workflows/ci-lint-validate-convert.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-lint-validate-convert.yml b/.github/workflows/ci-lint-validate-convert.yml index c2308582..1977a10d 100644 --- a/.github/workflows/ci-lint-validate-convert.yml +++ b/.github/workflows/ci-lint-validate-convert.yml @@ -18,15 +18,15 @@ env: jobs: lint: - name: Lint CSV - if: always() - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: csvlinter - uses: kcheriyath/csvlinter@V0.6.0 - with: - find_pattern: "*.csv" + name: Lint CSV + if: always() + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: csvlinter + uses: kcheriyath/csvlinter@V0.6.0 + with: + find_pattern: "*.csv" validate: name: Validate CSV From 0d7c6416c68a83a36fb6e93985ebe6d616e94d67 Mon Sep 17 00:00:00 2001 From: Aditi <63365451+aditigopalan@users.noreply.github.com> Date: Mon, 22 Jul 2024 16:03:56 -0400 Subject: [PATCH 5/5] Update ci-lint-validate-convert.yml --- .github/workflows/ci-lint-validate-convert.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-lint-validate-convert.yml b/.github/workflows/ci-lint-validate-convert.yml index 1977a10d..d08d9409 100644 --- a/.github/workflows/ci-lint-validate-convert.yml +++ b/.github/workflows/ci-lint-validate-convert.yml @@ -18,10 +18,10 @@ env: jobs: lint: - name: Lint CSV - if: always() - runs-on: ubuntu-latest - steps: + name: Lint CSV + if: always() + runs-on: ubuntu-latest + steps: - uses: actions/checkout@v4 - name: csvlinter uses: kcheriyath/csvlinter@V0.6.0