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

Feature: Twitter release announcement #129

Closed
wants to merge 31 commits into from
Closed

Feature: Twitter release announcement #129

wants to merge 31 commits into from

Conversation

ghostwriter
Copy link
Contributor

@ghostwriter ghostwriter commented Apr 11, 2021

Q A
New Feature yes
RFC yes

Description

This PR attempts to resolve #24

  • Add abraham/twitteroauth

  • Add support for Twitter EnvironmentVariables

  • Update example workflows

Tweet will be extracted from the milestone, if code block matches:

``` tweet
my announcement tweet goes here.
```

If one is not found, it will create a default tweet.

Released: {repository} {version} https://github.com/{repository}/releases/tag/{version}

Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
@Ocramius
Copy link
Member

Ocramius commented Apr 20, 2021

I jumped in waaaay too late on this: I think this should perhaps be an on: tag feature, rather than a manually triggered command that operates on a milestone.

EDIT: sorry, tabbed to close and comment instead of comment -.-

@Ocramius Ocramius closed this Apr 20, 2021
@Ocramius Ocramius reopened this Apr 20, 2021
@@ -88,6 +108,10 @@ public static function fromEnvironment(ImportGpgKeyFromString $importKey): self
self::getenv('GITHUB_EVENT_PATH'),
self::getenv('GITHUB_WORKSPACE'),
self::getenvWithFallback('LOG_LEVEL', 'INFO'),
self::getenv('TWITTER_CONSUMER_API_KEY'),
Copy link
Member

Choose a reason for hiding this comment

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

This makes configuring these API keys kinda required, which is a problem.

Would be best to have them completely separately configured, perhaps?

Also, are 4 secrets really needed? Sounds complex 🤔

Copy link
Member

Choose a reason for hiding this comment

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

Twitter oauth1 crap.

$response = $this->statusesUpdate($tweet);

$responseObject = $response->toValue();
Assert::isInstanceOf($responseObject, stdClass::class);
Copy link
Member

Choose a reason for hiding this comment

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

Urgh, is our API client this bad? :S

Copy link
Member

Choose a reason for hiding this comment

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

We're doing the same as most API clients and just running json_decode() on the response payload, because it keeps us future-proof. 😄

Copy link
Member

Choose a reason for hiding this comment

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

Did you just tell me "yes, our API client is that bad!"?

Copy link
Contributor

Choose a reason for hiding this comment

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

At least it's not terrible, so it's good that it's bad, so at least it's not terrible :D

Copy link
Member

Choose a reason for hiding this comment

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

Let's just say it's of roughly equal quality to every other API client out there. 😛

final class Tweet
{
/** @psalm-var non-empty-string */
private const TEMPLATE = 'Released: {repository} {version} https://github.com/{repository}/releases/tag/{version}';
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if there could be a short description, extracted from the milestone, to tweet some text with it?

@weierophinney
Copy link
Member

weierophinney commented Apr 22, 2021

I jumped in waaaay too late on this: I think this should perhaps be an on: tag feature, rather than a manually triggered command that operates on a milestone.

I'm actually thinking this too, especially since there are already actions out there that can do this.

As an example, the Send Tweet Action could be configured into a workflow:

name: Send a Tweet
on:
  release:
    types: [published]
jobs:
  tweet:
    runs-on: ubuntu-latest
    steps:
      - id: notes
        run: |
          MESSAGE="Just released: ${GITHUB_REPOSITORY} ${GITHUB_REF}: https://github.com/${GITHUB_REPOSITORY}/releases/tag/${GITHUB_REF}"
          echo "::set-output name=status::${MESSAGE}"

      - uses: ethomson/send-tweet-action@v1
        with:
          status: ${{ steps.notes.outputs.status }}
          consumer-key: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
          consumer-secret: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
          access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }}
          access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}

This can then be dropped into a separate workflow file. This approach makes it completely opt-in, which I like, and allows customizing the status message however you want.

Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
Signed-off-by: Nathanael Esayeas <[email protected]>
@ghostwriter ghostwriter changed the base branch from 1.12.x to 1.14.x December 15, 2021 23:25
@ghostwriter ghostwriter changed the base branch from 1.14.x to 1.12.x December 19, 2021 01:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Automate release announcement on twitter
5 participants