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

docs: add example YAML for workflow_dispatch #358

Merged
merged 3 commits into from
Nov 9, 2020
Merged

Conversation

bnb
Copy link
Contributor

@bnb bnb commented Oct 9, 2020

Why:

This page explains workflow_dispatch - it shows how to actually use the UI, but it's easy to land here wanting to know how to fully use it both in terms of UI and code. This adds a simple example of the syntax for how to use it.

What's being changed:

Adding a H3 (aligned with the other headings) and a small code example.

Check off the following:

@welcome
Copy link

welcome bot commented Oct 9, 2020

Thanks for opening this pull request! A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

@janiceilene
Copy link
Contributor

Thanks for opening a PR 👍 Please fill out the pull request template and we'll get this up for review!

@bnb
Copy link
Contributor Author

bnb commented Oct 9, 2020

Did my best with the review of localization and content style, apologies if I missed anything - happy to make whatever changes necessary if I missed something 🙇🏻

@janiceilene
Copy link
Contributor

Thanks @bnb Can you fill out the Why and the What's being changed? in your original comment in this PR? That'll help us to triage and find the best reviewers for your pull request. Thank you so much!

@bnb
Copy link
Contributor Author

bnb commented Oct 10, 2020

My apologies @janiceilene, should be fixed now, I totally spaced not once but twice. Thank you for being patient with me 🙇🏻

@janiceilene
Copy link
Contributor

Thank you so much @bnb! I think the format of the PR template wasn't the best. The big warning at the top made it super easy to bypass completely. I tweaked it this morning, so hopefully it's a bit more welcoming! I'll get this triaged for review 💝

@janiceilene janiceilene added actions This issue or pull request should be reviewed by the docs actions team content This issue or pull request belongs to the Docs Content team ecosystem This issue or pull request should be reviewed by the Docs Ecosystem team labels Oct 13, 2020
Copy link
Contributor

@rachmari rachmari left a comment

Choose a reason for hiding this comment

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

@bnb thank you for pointing out this missing information in the docs! 🙌 I think the addition you made definitely makes sense, but the article in this section are all geared toward how to accomplish something after the workflow is created. We may change that in the future, and your PR definitely prompted me to rethink that model.

I had a suggestion that wouldn't change the model we currently have but would require some additional changes. Let me know what you think! 💚 💭

@@ -32,3 +32,11 @@ To trigger the `workflow_dispatch` event on {% data variables.product.prodname_d
When using the REST API, you configure the `inputs` and `ref` as request body parameters. If the inputs are omitted, the default values defined in the workflow file are used.

For more information about using the REST API, see the "[Create a workflow dispatch event](/rest/reference/actions/#create-a-workflow-dispatch-event)."

### Example YAML
Copy link
Contributor

Choose a reason for hiding this comment

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

I agree that folks landing on this page might want to know about both the workflow configuration and how to use the UI, but we do already have an example workflow for this case on another page. Both sections "Running a workflow using the REST API" and "Running a workflow on GitHub" require the workflow to be configured for the workflow_dispatch, which is why we've included the paragraph linking to the events at the top of the article
https://github.com/github/docs/pull/358/files#diff-0d421d891ef5301f3a44801c5f65c183d09e5ffb890dfc8c95ea68f29311a402R13

But I realize that the link we include up there doesn't directly link to the workflow_dispatch event. 😬 It should.

To address the visibility of that link, maybe we can create a new section header for the information linking to the workflow_dispatch event description. So you could replace the paragraph at the top with:

### Configuring a workflow to run manually

To run a workflow manually, the workflow must be configured to run on the `workflow_dispatch` event. For more information about configuring the `workflow_dispatch` event, see "[Events that trigger workflows](/actions/reference/events-that-trigger-workflows#workflow_dispatch)."

We could then also include your example here as an alternate example on this page: https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#example-workflow-configuration

For example:

Example

on: workflow_dispatch

Example configuration with inputs

This example defines the name and home inputs and prints them using the github.event.inputs.name and github.event.inputs.home contexts. If a name isn't provided, the default value 'Mona the Octocat' is printed.

name: Manually triggered workflow
on:
  workflow_dispatch:
    inputs:
      name:
        description: 'Person to greet'
        required: true
        default: 'Mona the Octocat'
      home:
        description: 'location'
        required: false

jobs:
  say_hello:
    runs-on: ubuntu-latest
    steps:
    - run: |
        echo "Hello ${{ github.event.inputs.name }}!"
        echo "- in ${{ github.event.inputs.home }}!"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This makes sense. Would you like me to do that work in this PR, create a new one, or would it be something y'all would want to do yourselves?

Copy link
Contributor

Choose a reason for hiding this comment

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

@bnb feel free to update this PR if you'd like to. Our team probably won't be able to get to this for a bit, so any contributions you make here would be super helpful!

@janiceilene janiceilene added the hacktoberfest-accepted We might not merge this PR before Nov 1st, but it's a wonderful Hacktoberfest contribution! label Oct 27, 2020
@bnb
Copy link
Contributor Author

bnb commented Nov 2, 2020

force pushed the changes @rachmari suggested (to the best of my understanding of them) 👍🏻

Copy link
Contributor

@rachmari rachmari left a comment

Choose a reason for hiding this comment

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

@bnb this update looks great! I just had a few copy edit suggestions, but once those are fixed up I'll get this merged. 🚢 :shipit: 🚀

content/actions/reference/events-that-trigger-workflows.md Outdated Show resolved Hide resolved
bnb and others added 2 commits November 9, 2020 15:52
Copy link
Contributor

@rachmari rachmari left a comment

Choose a reason for hiding this comment

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

@bnb thanks! That was the last thing I needed. I'll get this shipped right now. 🚢 🚢 🚢

@rachmari rachmari merged commit 3b3d0a0 into github:main Nov 9, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2020

Thanks very much for contributing! Your pull request has been merged 🎉 You should see your changes appear on the site in approximately 24 hours.

Copy link

@GokhanAydinnn GokhanAydinnn left a comment

Choose a reason for hiding this comment

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

11 nn

This was referenced Jan 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actions This issue or pull request should be reviewed by the docs actions team content This issue or pull request belongs to the Docs Content team ecosystem This issue or pull request should be reviewed by the Docs Ecosystem team hacktoberfest-accepted We might not merge this PR before Nov 1st, but it's a wonderful Hacktoberfest contribution!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants