Skip to content

HPC-BP: add new event from ideas-productivity.org #32

HPC-BP: add new event from ideas-productivity.org

HPC-BP: add new event from ideas-productivity.org #32

# Add new HPC Best Practices webinar event from ideas-productivity.org site
name: "HPC-BP: add new event from ideas-productivity.org"
on:
workflow_dispatch:
inputs:
event-file:
description: 'Basename of HPC-BP event on ideas-productivity.org (without extension)'
required: true
type: string
jobs:
hpcbp-event-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v4
# - name: Check the file is there
# run: |
# ls -l Events/${{ inputs.event-file }}.md || :
- name: Download the new curated content article
uses: carlosperate/download-file-action@v2
with:
file-url: https://ideas-productivity.org/internal/events-hpcbp-bsswio/${{ inputs.event-file }}
location: 'Events'
file-name: ${{ inputs.event-file }}.md
# - name: Check the file is there
# run: |
# ls -l Events/${{ inputs.event-file }}.md || :
- name: Create pull request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
title: Add new HPC-BP webinar event
branch: ${{ github.actor }}-hpcbp-new-event
branch-suffix: timestamp
assignees: ${{ github.actor }}
commit-message: "Adding new HPC-BP webinar event from the ideas-productivity.org website"
body: "Adding new HPC-BP webinar event from the ideas-productivity.org website"
labels: |
content: event
- name: Check PR results
if: ${{ steps.cpr.outputs.pull-request-number }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
- name: Add pull request to appropriate project column
id: project-info
env:
GH_TOKEN: ${{ github.token }}
OWNER: ${{ github.repository_owner }}
REPO: ${{ github.event.repository.name }}
PROJ_NAME: "Content Development"
COL_NAME: "Ready for digest"
run: |
# Get project id
proj_id=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/$OWNER/$REPO/projects --jq ".[] | select(.name == \"$PROJ_NAME\") | .id")
# Get column id
col_id=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /projects/$proj_id/columns --jq ".[] | select(.name == \"$COL_NAME\") | .id")
echo Project board id = $proj_id
echo Column id = $col_id
# Get pull request id
#pr_id=$(gh pr view ${{ steps.cpr.outputs.pull-request-url }} --json id --jq ".id")
pr_id=$(gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" /repos/$OWNER/$REPO/pulls/${{ steps.cpr.outputs.pull-request-number }} --jq ".id")
echo Pull request id = $pr_id
gh pr view
# Add pull request to column
gh api -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" -f content_type="PullRequest" -f content_id=$pr_id /projects/columns/$col_id/cards
# curl -s -X POST -u "$GITHUB_ACTOR:$TOKEN" --retry 3 \
# -H 'Accept: application/vnd.github.inertia-preview+json' \
# -d "{\"content_type\": \"PullRequest\", \"content_id\": $PULL_REQUEST_ID}" \
# "https://api.github.com/projects/columns/$INITIAL_COLUMN_ID/cards"
# - name: Merge PR
# if: ${{ steps.cpr.outputs.pull-request-number }}
# env:
# GH_TOKEN: ${{ secrets.PR_MERGE_PAT }}
# run: |
# gh pr merge ${{ steps.cpr.outputs.pull-request-number }} --merge --auto --body "Automatically merging script-generated event"