-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from WCRP-CORDEX/workflow
Workflow
- Loading branch information
Showing
7 changed files
with
90 additions
and
8 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,68 @@ | ||
name: Process registration | ||
on: | ||
repository_dispatch: | ||
types: [register-command] | ||
concurrency: 'main' | ||
jobs: | ||
add_id: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
issues: write | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '16' | ||
|
||
- name: Setup Python | ||
uses: actions/[email protected] | ||
with: | ||
python-version: 3.9 | ||
- name: Show info | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
echo ${{ github.event.label.name }} | ||
#echo ${{ github.event.client_payload.github.payload.issue.label }} | ||
gh api --jq '.labels.[].name' /repos/{owner}/{repo}/issues/${{ github.event.number }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
cd scripts; pip install -e . --no-deps | ||
- name: check labels | ||
id: label | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
table=`python labels.py /repos/{owner}/{repo}/issues/${{ github.event.client_payload.github.payload.issue.number }}` | ||
echo $table | ||
echo "table=$table" >> $GITHUB_OUTPUT | ||
- uses: stefanbuck/github-issue-parser@v3 | ||
id: issue-parser | ||
with: | ||
template-path: .github/ISSUE_TEMPLATE/${{ steps.label.outputs.table }}.yaml | ||
issue-body: ${{ github.event.client_payload.github.payload.issue.body }} | ||
|
||
- name: update table | ||
id: update | ||
run: | | ||
id_added=`python scripts/update-${{ steps.label.outputs.table }}.py '${{ steps.issue-parser.outputs.jsonString }}'` | ||
echo "id_added=$id_added" >> $GITHUB_OUTPUT | ||
# - name: Create Pull Request | ||
# uses: peter-evans/create-pull-request@v5 | ||
# with: | ||
# title: add ${{ steps.issue-parser.outputs.issueparser_source_id }} | ||
# commit-message: add-${{ steps.issue-parser.outputs.issueparser_source_id }} | ||
# branch: add-${{ steps.issue-parser.outputs.issueparser_source_id }} | ||
# body: | | ||
# Closes #${{ github.event.issue.number }} | ||
# Request to add ${{ steps.issue-parser.outputs.issueparser_source_id }} | ||
# delete-branch: true |
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
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
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
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,13 @@ | ||
import sys | ||
import subprocess | ||
|
||
issue = sys.argv[1] | ||
command = ["gh", "api", "--jq", ".labels.[].name", issue] | ||
result = subprocess.run(command, stdout=subprocess.PIPE) | ||
labels = result.stdout.decode("utf-8").splitlines() | ||
|
||
for lb in labels: | ||
table = lb.split("register")[1].strip() if "register" in lb else None | ||
if table: | ||
break | ||
print(f"{table}") |
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
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