Skip to content

Conversation

calvn
Copy link

@calvn calvn commented Dec 23, 2023

This PR adds support for the jira sync workflow to be triggered by workflow_dispatch. This can be useful for repositories that does not necessarily want to automatically import PR's and issues, but still provide an easy way to manually and selectively do so if needed. The hashicorp/vault repository could make use of this, for instance.

Note that workflow_dispatch only targets the Jira creation step. Other steps such as syncing or closing tickets can still be managed automatically through event triggers like comment updates or closure on PR's or issues once that has been imported.

echo "gh_number=${{ inputs.dispatch-gh-number }}" >> "$GITHUB_OUTPUT"
if [[ "${{ inputs.dispatch-gh-type }}" == "PR" ]]; then
TITLE=$(gh pr view ${{ inputs.dispatch-gh-number }} --json=title -q .title)
Copy link
Author

Choose a reason for hiding this comment

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

TODO: I can probably make these be a single CLI call and extract values from the output independently.


- name: Search
if: github.event.action != 'opened'
if: github.event_name != 'workflow_dispatch' && github.event.action != 'opened'
Copy link
Author

@calvn calvn Dec 23, 2023

Choose a reason for hiding this comment

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

Not sure if this is needed, but I am explicitly excluding workflow dispatch events from other non-creation steps just in case, since a lot of the checks are against github.event.action but I'm using github.event_name to determine where the trigger is coming from.

# name: JIRA Sync
# on:
# issues:
# workflow_dispatch: # Optional, allows for import through workflow_dispatch
Copy link
Author

Choose a reason for hiding this comment

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

Might be cleaner to provider two separate examples rather than mixing the two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant