Update GitHub actions to v2 (#10441)

* Update GitHub actions to v2 [skip ci]

* Only run when needed for issues [skip ci]
This commit is contained in:
Nicolò Ribaudo 2019-09-16 22:38:12 +02:00 committed by GitHub
parent 256fa5aa04
commit e4b4831100
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 134 additions and 76 deletions

76
.github/main.workflow vendored
View File

@ -1,76 +0,0 @@
workflow "Release" {
on = "push"
resolves = ["Trigger GitHub release"]
}
action "Is version tag" {
uses = "actions/bin/filter@0dbb077f64d0ec1068a644d25c71b1db66148a24"
args = "tag v*"
}
action "Is tag from master" {
uses = "babel/actions/commit-matches-branch@master"
needs = [
"Is version tag",
]
args = "master"
}
action "Trigger GitHub release" {
uses = "babel/actions/trigger-github-release@master"
secrets = ["GITHUB_TOKEN"]
env = {
COMMIT_AUTHOR_NAME = "Babel Bot"
COMMIT_AUTHOR_EMAIL = "babel-bot@users.noreply.github.com"
}
needs = [
"Is version tag",
"Is tag from master",
]
}
workflow "Welcome" {
resolves = [
"Create Welcome Comment"
]
on = "issues"
}
action "Is action 'opened'" {
uses = "actions/bin/filter@master"
args = "action opened"
}
action "Create Welcome Comment" {
uses = "babel/actions/create-welcome-comment@master"
secrets = ["GITHUB_TOKEN", "BOT_TOKEN"]
needs = ["Is action 'opened'"]
}
workflow "Needs Info" {
resolves = [
"Create Needs Info Comment"
]
on = "issues"
}
action "Is action 'labeled'" {
uses = "actions/bin/filter@master"
args = "action labeled"
}
action "Has label 'Needs Info'" {
uses = "actions/bin/filter@master"
needs = [
"Is action 'labeled'"
]
args = "label 'Needs Info'"
}
action "Create Needs Info Comment" {
uses = "babel/actions/create-needs-info-comment@master"
needs = [
"Has label 'Needs Info'",
]
secrets = ["BOT_TOKEN", "GITHUB_TOKEN"]
}

81
.github/workflows/issue-triage.yml vendored Normal file
View File

@ -0,0 +1,81 @@
name: Issue Triage
on:
issues:
types: [opened, labeled]
jobs:
welcome:
name: Welcome comment
runs-on: ubuntu-latest
steps:
- name: Check if Babel member
id: is_babel_member
if: github.event.action == 'opened'
uses: babel/actions/is-org-member@v2
with:
org: babel
username: ${{ github.event.issue.user.login }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create Welcome Comment
uses: babel/actions/create-comment@v2
if: |
github.event.action == 'opened' &&
steps.is_babel_member.outputs.result == 0
with:
token: ${{ secrets.BOT_TOKEN }}
issue: ${{ github.event.issue.number }}
comment: >
Hey @${{ github.event.issue.user.login }}!
We really appreciate you taking the time to report an issue. The
collaborators on this project attempt to help as many people as
possible, but we're a limited number of volunteers, so it's
possible this won't be addressed swiftly.
If you need any help, or just have general Babel or JavaScript questions, we have a
vibrant [Slack community](https://babeljs.slack.com) that typically always has someone
willing to help. You can sign-up [here](https://slack.babeljs.io/) for an invite."
needs_info:
name: Needs Info
runs-on: ubuntu-latest
steps:
- name: Create Needs Info Comment
uses: babel/actions/create-comment@v2
if: |
github.event.action == 'labeled' &&
github.event.label.name == 'Needs Info'
with:
token: ${{ secrets.BOT_TOKEN }}
issue: ${{ github.event.issue.number }}
comment: >
Hi @${{ github.event.issue.user.login }}!
This issue is missing some important information we'll need
to be able to reproduce this issue.
Please understand that we receive a high volume of issues,
and there are only a limited number of volunteers that help
maintain this project. The easier it is for us to decipher an
issue with the info provided, the more likely it is that we'll
be able to help.
Please make sure you have the following information documented in
this ticket:
1. Your Babel configuration (typically from `.babelrc` or `babel.config.js`)
2. The current (incorrect) behavior you're seeing
3. The behavior you expect
4. A [short, self-contained example](http://sscce.org/)
Please provide either a link to the problem via the
[`repl`](https://babeljs.io/repl/), or if the `repl` is
insufficient, a new and minimal repository with instructions on
how to build/replicate the issue.

53
.github/workflows/release.yml vendored Normal file
View File

@ -0,0 +1,53 @@
name: Release
on:
push:
tags: ["v*"]
jobs:
github_release:
name: Trigger GitHub release
runs-on: ubuntu-latest
steps:
- name: Checkout the new tag
uses: actions/checkout@v1.0.0
- name: Get tag info
id: tags
uses: babel/actions/get-release-tags@v2
- name: Generate the changelog
id: changelog
uses: babel/actions/generate-lerna-changelog@v2
with:
from: ${{ steps.tags.outputs.old }}
to: ${{ steps.tags.outputs.new }}
env:
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
- name: Create a draft GitHub release
uses: babel/actions/publish-github-release@v2
with:
tag: ${{ steps.tags.outputs.new }}
changelog: ${{ steps.changelog.outputs.changelog }}
token: ${{ secrets.BOT_TOKEN }}
- name: Check if releasing from master
id: is_master
uses: babel/actions/ref-matches-branch@v2
with:
name: master
- name: Update CHANGELOG.md
if: steps.is_master.outputs.result == 1
uses: babel/actions/update-changelog@v2
with:
changelog: ${{ steps.changelog.outputs.changelog }}
- name: Commit CHANGELOG.md
if: steps.is_master.outputs.result == 1
run: |
git add CHANGELOG.md
git -c user.name="Babel Bot" -c user.email="babel-bot@users.noreply.github.com" \
commit -m "Add ${{ steps.tags.outputs.new }} to CHANGELOG.md [skip ci]" --no-verify --quiet
git push "https://babel-bot:${{ secrets.BOT_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" master