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

add scala-steward workflow #2218

Merged
merged 1 commit into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
ci:
# run on external PRs, but not on internal PRs since those will be run by push to branch
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository || github.event.pull_request.user.login == 'github-actions'
runs-on: ubuntu-20.04
strategy:
fail-fast: false
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:

mima:
# run on external PRs, but not on internal PRs since those will be run by push to branch
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository || github.event.pull_request.user.login == 'github-actions'
runs-on: ubuntu-20.04
steps:
- name: Checkout
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/scala-steward.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Scala Steward

# This workflow will launch at 00:00 every day
on:
schedule:
- cron: '0 0 * * *'

jobs:
scala-steward:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v1
with:
java-version: 11
- name: Cache sbt
uses: actions/cache@v2
with:
path: |
~/.sbt
~/.ivy2/cache
~/.coursier
key: sbt-cache-${{ runner.os }}-JVM-${{ hashFiles('project/build.properties') }}
- name: Launch Scala Steward
uses: scala-steward-org/scala-steward-action@v2
with:
author-name: scala-steward
Copy link
Member

Choose a reason for hiding this comment

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

so this is ignored and we always end up with github-actions? Would be nice to somehow distinguish commits coming from scala-steward, though. I'm afraid there might be other instances of automatic commits coming from the github-actions author, which might end up inadvertendly being merged. But maybe since the mergify config explicitly mentiones the files, it's not a problem

Copy link
Contributor Author

@mkrzemien mkrzemien Jun 13, 2022

Choose a reason for hiding this comment

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

  • author-name/email: scala-stuard is used as a commit author
  • github-actions is used as a user, who opened a PR
  • it is possible to distinguish PRs created by scala-stuard from inside the CI workflow (using some specific conditions) only the trouble is that the PR workflow is not triggered at all (even with no conditions inside the workflow)
  • when I manually close and reopen the PR then the CI workflow is triggered successfully (in this case I'm represented as the PR reopener)

Copy link
Contributor Author

@mkrzemien mkrzemien Jun 13, 2022

Choose a reason for hiding this comment

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

My proposal for the followup:

  • merge the scala-steward action without supporting mergify (scala-steward generates PRs properly, they just need to be accepted by hand); maybe with lower frequency (e.g. once a week?)
  • open another issue to debug the problem with workflows not triggered (if solved then add mergify to scala-steward)
  • create another issue to simplify (remove duplications) from CI workflow definitions (it's possible to extract common actions like sbt setup/cleanup)

Copy link
Member

Choose a reason for hiding this comment

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

ah ... so we cannot change the user who is opening the PR?

maybe it's a matter of clicking "allow workflow to run" until the first PR from github-actions is merged?

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with merging this without mergify and fixing it in the next PR :)

Copy link
Member

Choose a reason for hiding this comment

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

but the frequency of once-per-day is fine :)

author-email: scala-steward
github-token: ${{ secrets.GITHUB_TOKEN }}
repo-config: .scala-steward.conf
ignore-opts-files: false
- name: Cleanup
run: |
rm -rf "$HOME/.ivy2/local" || true
find $HOME/.ivy2/cache -name "ivydata-*.properties" -delete || true
find $HOME/.ivy2/cache -name "*-LM-SNAPSHOT*" -delete || true
find $HOME/.cache/coursier/v1 -name "ivydata-*.properties" -delete || true
find $HOME/.sbt -name "*.lock" -delete || true
28 changes: 14 additions & 14 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pull_request_rules:
conditions: []
actions:
delete_head_branch: {}
- name: automatic merge for scala-steward pull requests affecting build.sbt
- name: automatic merge for github-actions pull requests affecting build.sbt
conditions:
- author=scala-steward
- author=github-actions
- check-success=ci (JVM)
- check-success=ci (JS)
- check-success=mima
Expand All @@ -14,9 +14,9 @@ pull_request_rules:
actions:
merge:
method: merge
- name: automatic merge for scala-steward pull requests affecting project plugins.sbt
- name: automatic merge for github-actions pull requests affecting project plugins.sbt
conditions:
- author=scala-steward
- author=github-actions
- check-success=ci (JVM)
- check-success=ci (JS)
- check-success=mima
Expand All @@ -25,19 +25,19 @@ pull_request_rules:
actions:
merge:
method: merge
- name: semi-automatic merge for scala-steward pull requests
- name: semi-automatic merge for github-actions pull requests
conditions:
- author=scala-steward
- author=github-actions
- check-success=ci (JVM)
- check-success=ci (JS)
- check-success=mima
- "#approved-reviews-by>=1"
actions:
merge:
method: merge
- name: automatic merge for scala-steward pull requests affecting project build.properties
- name: automatic merge for github-actions pull requests affecting project build.properties
conditions:
- author=scala-steward
- author=github-actions
- check-success=ci (JVM)
- check-success=ci (JS)
- check-success=mima
Expand All @@ -46,9 +46,9 @@ pull_request_rules:
actions:
merge:
method: merge
- name: automatic merge for scala-steward pull requests affecting .scalafmt.conf
- name: automatic merge for github-actions pull requests affecting .scalafmt.conf
conditions:
- author=scala-steward
- author=github-actions
- check-success=ci (JVM)
- check-success=ci (JS)
- check-success=mima
Expand All @@ -57,9 +57,9 @@ pull_request_rules:
actions:
merge:
method: merge
- name: automatic merge for scala-steward pull requests affecting project Versions.scala
- name: automatic merge for github-actions pull requests affecting project Versions.scala
conditions:
- author=scala-steward
- author=github-actions
- check-success=ci (JVM)
- check-success=ci (JS)
- check-success=mima
Expand All @@ -68,9 +68,9 @@ pull_request_rules:
actions:
merge:
method: merge
- name: add label to scala steward PRs
- name: add label to github-actions PRs
conditions:
- author=scala-steward
- author=github-actions
actions:
label:
add:
Expand Down
8 changes: 7 additions & 1 deletion .scala-steward.conf
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
updates.ignore = [{groupId = "com.softwaremill.sbt-softwaremill"}, {groupId = "org.scala-sbt"}]
updates.ignore = [
{groupId = "com.softwaremill.sbt-softwaremill"},
{groupId = "org.scala-sbt"},
{groupId = "org.scala-lang", artifactId = "scala-compiler", version = "2.12."},
{groupId = "org.scala-lang", artifactId = "scala-compiler", version = "2.13."},
{groupId = "org.scala-lang", artifactId = "scala-compiler", version = "3."}
Copy link
Member

Choose a reason for hiding this comment

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

hm don't we want scala version upgrades?

Copy link
Contributor Author

@mkrzemien mkrzemien Jun 13, 2022

Choose a reason for hiding this comment

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

With this configuration each Scala "major" version (2.12, 2.13, 3) still gets upgraded within given "major" version (e.g.: 2.12.14 -> 2.12.15) but "major" versions are not changed.
Without this configuration "major" versions also get changed: 2.12.15 -> 2.13.8, 2.13.8 -> 3.1.2)

In result you get:

val scala2_12 = "2.13.8"
val scala2_13 = "2.13.8"

Copy link
Member

Choose a reason for hiding this comment

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

ah ok :) thanks

]