Skip to content
Snippets Groups Projects
Unverified Commit 1d3adda6 authored by Mike McQuaid's avatar Mike McQuaid
Browse files

workflows: cleanup/fix tapioca and spdx update.

parent 3b71e3d4
No related branches found
No related tags found
No related merge requests found
name: Update license data
name: Update SPDX license data
on:
push:
paths:
......@@ -19,17 +19,33 @@ jobs:
with:
username: BrewTestBot
- name: Update license data
- name: Update SPDX license data
id: update
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cd "$GITHUB_WORKSPACE/Library/Homebrew"
if brew update-license-data --commit --fail-if-not-changed; then
SPDX_VERSION=$(jq -er .licenseListVersion data/spdx/spdx_licenses.json)
if ! git ls-remote --exit-code --heads origin "spdx-$SPDX_VERSION"; then
git checkout -b "spdx-$SPDX_VERSION"
git push origin "spdx-$SPDX_VERSION"
hub pull-request -m "$(git log -1 --format='%s')"
if brew update-license-data --fail-if-not-changed; then
if ! git ls-remote --exit-code --heads origin spdx-update; then
git checkout -B spdx-update
git commit -am "spdx: update license data." -m "Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/blob/master/.github/workflows/spdx.yml)."
echo "::set-output name=committed::true"
fi
fi
- name: Push commits
if: steps.update.outputs.committed == 'true'
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
branch: spdx-update
- name: Open a pull request
if: steps.update.outputs.committed == 'true'
run: |
cd "$GITHUB_WORKSPACE/Library/Homebrew"
hub pull-request --no-edit
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
name: Tapioca Update
name: Update Tapioca definitions
on:
push:
paths:
- .github/workflows/tapioca-update.yml
- .github/workflows/tapioca.yml
schedule:
- cron: '0 0 */3 * *' # every three days
env:
HOMEBREW_SORBET: 1
- cron: '0 */12 * * *'
jobs:
update-tapioca:
tapioca:
if: github.repository == 'Homebrew/brew'
runs-on: ubuntu-latest
steps:
......@@ -21,37 +19,45 @@ jobs:
with:
username: BrewTestBot
# TODO: remove with `brew typecheck`
- name: Set up Ruby
uses: ruby/setup-ruby@v1
uses: actions/setup-ruby@main
with:
ruby-version: 2.6.3
ruby-version: '2.6'
- name: Install RubyGems
run: |
cd "$GITHUB_WORKSPACE/Library/Homebrew"
gem install bundler -v "~>1"
bundle install --jobs 4 --retry 3
- name: Update Tapioca Definitions
- name: Update Tapioca definitions
id: update
run: |
cd "$GITHUB_WORKSPACE/Library/Homebrew"
bundle install
# TODO: replace with `brew typecheck`
bundle exec tapioca sync --exclude json
bundle exec srb rbi hidden-definitions
if ! git diff --exit-code -- sorbet; then
BRANCH="tapioca-update"
if ! git ls-remote --exit-code --heads origin "$BRANCH"; then
git checkout -b "$BRANCH"
git commit -am "sorbet: Update gem RBI files using Tapioca
Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/actions?query=workflow%3A%22Tapioca+Update%22)."
git checkout -B tapioca-update
if ! git diff --exit-code -- sorbet; then
if ! git ls-remote --exit-code --heads origin tapioca-update; then
git commit -am "sorbet: update RBI files using Tapioca." -m "Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/blob/master/.github/workflows/tapioca.yml)."
echo "::set-output name=committed::true"
fi
fi
- name: Push commits
if: steps.update.outputs.committed == 'true'
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
branch: tapioca-update
directory: Library/Homebrew/
- name: Open a PR
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
- name: Open a pull request
if: steps.update.outputs.committed == 'true'
run: |
cd "$GITHUB_WORKSPACE/Library/Homebrew"
hub pull-request -m "$(git log -1 --format='%s%n%n%b')"
hub pull-request --no-edit
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }}
......@@ -16,8 +16,6 @@ module Homebrew
switch "--fail-if-not-changed",
description: "Return a failing status code if current license data's version is the same as " \
"the upstream. This can be used to notify CI when the SPDX license data is out of date."
switch "--commit",
description: "Commit changes to the SPDX license data."
max_named 0
end
end
......@@ -27,14 +25,8 @@ module Homebrew
ohai "Updating SPDX license data..."
SPDX.download_latest_license_data!
return unless args.fail_if_not_changed?
Homebrew.failed = system("git", "diff", "--stat", "--exit-code", SPDX::DATA_PATH) if args.fail_if_not_changed?
return unless args.commit?
ohai "git add"
safe_system "git", "add", SPDX::DATA_PATH
ohai "git commit"
system "git", "commit", "--message", "spdx license data: update to #{SPDX.latest_tag}"
Homebrew.failed = system("git", "diff", "--stat", "--exit-code", SPDX::DATA_PATH)
end
end
......@@ -1198,8 +1198,6 @@ working directory.
* `--fail-if-not-changed`:
Return a failing status code if current license data's version is the same as the upstream. This can be used to notify CI when the SPDX license data is out of date.
* `--commit`:
Commit changes to the SPDX license data.
### `update-python-resources` [*`options`*] *`formula`*
......
......@@ -1636,10 +1636,6 @@ Update SPDX license data in the Homebrew repository\.
\fB\-\-fail\-if\-not\-changed\fR
Return a failing status code if current license data\'s version is the same as the upstream\. This can be used to notify CI when the SPDX license data is out of date\.
.
.TP
\fB\-\-commit\fR
Commit changes to the SPDX license data\.
.
.SS "\fBupdate\-python\-resources\fR [\fIoptions\fR] \fIformula\fR"
Update versions for PyPI resource blocks in \fIformula\fR\.
.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment