New version: Polynomials4ML v0.2.0 #26191
Workflow file for this run
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
# This workflow announces new packages when PRs are merged | |
name: Announce | |
on: | |
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-your-workflow-when-a-pull-request-merges | |
pull_request: | |
types: | |
- closed | |
permissions: | |
contents: read | |
jobs: | |
announce-twitter: | |
# https://stackoverflow.com/a/59588725/12486544 | |
if: ${{ github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'new package') }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: julia-actions/setup-julia@f40c4b69330df1d22e7590c12e76dc2f9c66e0bc # v1.9.2 | |
with: | |
version: 1.7.2 | |
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.3.0 | |
- name: Send to Twitter | |
shell: julia --color=yes {0} | |
run: | | |
include(joinpath(ENV["GITHUB_WORKSPACE"], ".ci", "parse_env.jl")) | |
text, pr_url = parse_env(ENV) | |
using Pkg | |
Pkg.activate(mktempdir()) | |
Pkg.add(name="Twitter", version="0.9") | |
using Twitter | |
twitterauth(ENV["API_Key"], ENV["API_Key_Secret"], ENV["Access_Token"], ENV["Access_Token_Secret"]) | |
myStatus = string(ENV["PR_NAME"], " announced #JuliaLang\n\n$text") | |
@info "Tweet to be sent: $myStatus" | |
@info "Tweet length: $(length(myStatus))" | |
response = post_status_update(status=myStatus) | |
@info "Twitter said: $response" | |
env: | |
SLACK_ENDPOINT: ${{ secrets.JULIALANGSLACKENDPOINT }} | |
PR_NAME: ${{ github.event.pull_request.title }} | |
PR_NUMBER: ${{ github.event.number }} | |
PR_BODY: ${{ github.event.pull_request.body }} | |
API_Key: ${{ secrets.Twitter_API_Key }} | |
API_Key_Secret: ${{ secrets.Twitter_API_Key_Secret }} | |
Access_Token: ${{ secrets.Twitter_Access_Token }} | |
Access_Token_Secret: ${{ secrets.Twitter_Access_Token_Secret }} |