On Pull Request #18
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
name: On Pull Request 1 | |
on: | |
workflow_dispatch: | |
#pull_request: | |
#paths: | |
# - '**/*.gpml' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: false # to allow multiple runs to queue up rather than clobber | |
jobs: | |
get-gpml-pr: | |
runs-on: ubuntu-latest | |
outputs: | |
pr-number: ${{ steps.changes.outputs.pr-number }} | |
added-modified: ${{ steps.changes.outputs.added-modified }} | |
deleted: ${{ steps.changes.outputs.deleted }} | |
steps: | |
# Make sure we have some code to diff. | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Get PR and GPML | |
id: changes | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} #only need to support TESTING | |
run: | | |
echo "GPML files were changed in pull request ${{ github.event.before }} -> ${{ github.event.after }}" | |
#echo "pr-number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT | |
echo "pr-number=4" >> $GITHUB_OUTPUT #TESTING | |
#echo "added-modified=$(git diff --name-only --diff-filter=AM ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$ | xargs)" >> $GITHUB_OUTPUT | |
echo "added-modified=$(gh pr view 4 --json files --jq '.files.[].path' | grep '.gpml$')" >> $GITHUB_OUTPUT #TESTING | |
if git diff --name-only --diff-filter=AM ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$; then | |
echo 'added or modified:' | |
git diff --name-only --diff-filter=AM ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$ | |
fi | |
echo "deleted=$(git diff --name-only --diff-filter=D ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$ | xargs)" >> $GITHUB_OUTPUT | |
if git diff --name-only --diff-filter=D ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$; then | |
echo 'deleted:' | |
git diff --name-only --diff-filter=D ${{ github.event.before }} ${{ github.event.after }} | grep .gpml$ | |
fi | |
test_one: | |
runs-on: ubuntu-latest | |
needs: [get-gpml-pr] | |
if: ${{needs.get-gpml-pr.outputs.added-modified}} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Check GPML file | |
run: | | |
GPML_FILE=${{needs.get-gpml-pr.outputs.added-modified}} | |
echo "Found .gpml file: $GPML_FILE" | |
- name: Update PR description | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
PR_NUMBER=${{needs.get-gpml-pr.outputs.pr-number}} | |
# Get the current PR description | |
CURRENT_DESCRIPTION=$(gh pr view $PR_NUMBER --json body -q ".body") | |
# Modify the description. For this example, let's just append some text. | |
NEW_DESCRIPTION="$CURRENT_DESCRIPTION | |
- [x] Test one" | |
# Update the PR description with the modified content | |
gh pr edit $PR_NUMBER --body "$NEW_DESCRIPTION" | |
test_two_a: | |
needs: [get-gpml-pr, test_one] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Do stuff in parallel with test_two_b | |
run: | | |
echo "Do stuff in parallel with test_two_b" | |
test_two_b: | |
needs: [get-gpml-pr, test_one] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Do stuff in parallel with test_two_a | |
run: | | |
echo "Do stuff in parallel with test_two_a" | |
test_two_check: | |
needs: [get-gpml-pr, test_one, test_two_a, test_two_b] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Update PR description | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
PR_NUMBER=${{needs.get-gpml-pr.outputs.pr-number}} | |
# Get the current PR description | |
CURRENT_DESCRIPTION=$(gh pr view $PR_NUMBER --json body -q ".body") | |
# Modify the description. For this example, let's just append some text. | |
NEW_DESCRIPTION="$CURRENT_DESCRIPTION | |
- [x] Test two" | |
# Update the PR description with the modified content | |
gh pr edit $PR_NUMBER --body "$NEW_DESCRIPTION" |