Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update issue tagging to work without helper scripts #172

Merged
merged 17 commits into from
Feb 25, 2025
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions .github/workflows/issue_tagging.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:

on:
workflow_call:
pull_request_target:
pull_request:
types:
- review_requested
pull_request_review:
Expand All @@ -19,6 +19,7 @@ on:
jobs:
update_parent_issue:
runs-on: ubuntu-latest
container: quay.io/zathras/jira-issue-tagging-ci:latest
steps:
- uses: actions/checkout@v4

Expand All @@ -27,33 +28,33 @@ jobs:
run: echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> "$GITHUB_ENV"

- name: Get PR number on PR event
if: github.event_name == 'pull_request_target'
if: github.event_name == 'pull_request'
run: echo "PR_NUMBER=${{ github.event.number }}" >> "$GITHUB_ENV"

- name: Get parent issues
shell: bash
run: >
run: |
echo PARENT_ISSUES=$(
./ci/get_parent_issue.sh
$PR_NUMBER
) >> $GITHUB_ENV
/opt/tools/get_parent_issue.sh ${{ github.repository }} $PR_NUMBER
) >> "$GITHUB_ENV"


- name: Fail when unable to find a parent issue
if: env.PARENT_ISSUES == ''
run: echo "Could not find a parent issue" && exit 1

- name: Get PR states
- name: Get PR Status
run: >
echo PR_STATUS=pr_$(
gh pr view $PR_NUMBER --json reviewRequests,latestReviews |
python ./ci/determine_status.py
) >> $GITHUB_ENV
echo PR_STATUS=$(
gh -R ${{ github.repository }} pr view $PR_NUMBER --json reviewRequests,latestReviews |
python /opt/tools/determine_status.py
) >> "$GITHUB_ENV"

- name: Set parent issues state
run: >
for issue in $PARENT_ISSUES; do
echo "Updating $issue to $PR_STATUS" &&
gh issue edit $issue $REMOVE_ISSUES &&
gh issue edit $issue --add-label=$PR_STATUS
gh -R ${{ github.repository }} issue edit $issue $REMOVE_ISSUES &&
gh -R ${{ github.repository }} issue edit $issue --add-label=pr_$PR_STATUS
done

26 changes: 0 additions & 26 deletions ci/determine_status.py

This file was deleted.

9 changes: 0 additions & 9 deletions ci/get_parent_issue.sh

This file was deleted.

44 changes: 44 additions & 0 deletions tmp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this included by accident? If not it could really use a better file name than "tmp.json" unless the workflow demands it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, had that as a testing file and forgot to remove it.

"latestReviews": [
{
"id": "",
"author": {
"login": "gdumas"
},
"authorAssociation": "MEMBER",
"body": "",
"submittedAt": "2025-02-11T13:14:17Z",
"includesCreatedEdit": false,
"reactionGroups": [],
"state": "APPROVED",
"commit": {
"oid": ""
}
},
{
"id": "",
"author": {
"login": "dvalinrh"
},
"authorAssociation": "MEMBER",
"body": "",
"submittedAt": "2025-02-11T13:14:17Z",
"includesCreatedEdit": false,
"reactionGroups": [],
"state": "CHANGES_REQUESTED",
"commit": {
"oid": ""
}
}
],
"reviewRequests": [
{
"__typename": "User",
"login": "kdvalin"
},
{
"__typename": "User",
"login": "frival"
}
]
}