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

Modify sync-pr to be triggered on Solidity release #53

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
56 changes: 50 additions & 6 deletions .github/workflows/create-daily-docs-sync-pr.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: daily docs sync PR
name: docs sync PR on Solidity releases

on:
schedule:
Expand All @@ -12,8 +12,30 @@ env:
GITHUB_REPOSITORY_OWNER: solidity-docs

jobs:
checkSolidityRelease:
runs-on: ubuntu-latest
outputs:
current_release: ${{ steps.current-release-version.outputs.current_release }}
latest_release: ${{ steps.latest-release-version.outputs.latest_release }}
steps:
- uses: actions/checkout@v4
- name: Get current Solidity docs version
id: current-release-version
run: |
current_release=$(<latest_solidity.release)
echo "current_release=$current_release" >> $GITHUB_OUTPUT
- name: Get latest Solidity release version
id: latest-release-version
run: |
latest_release=$(
curl -sL https://api.github.com/repos/ethereum/solidity/releases/latest | jq --raw-output ".tag_name" | cut -d"v" -f2
)
echo "latest_release=$latest_release" >> $GITHUB_OUTPUT

createPullRequest:
runs-on: ubuntu-latest
needs: checkSolidityRelease
if: needs.checkSolidityRelease.outputs.current_release != needs.checkSolidityRelease.outputs.latest_release
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is not quite what I meant in #22. This will still create a daily sync PR, just at some arbitrary moment after the release. That's because pull-and-resolve-english-changes.sh will still pull code from develop and not the tag so it may have some extra commits.

Doing it properly, on the tag, isn't even really harder if you're replacing the daily sync PRs (rather than keeping support for both).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Another problem is that it can only create a PR for the latest release. We should really create a PR for the first untagged release in the repo and only when there's no other pending release sync PR (we can make that no pending sync PR in general for simplicity). So that translators can translate one version at a time. We could fall back to latest if the translation repo has no version tags though.

Doing it this way would actually be simpler, because you'd not need this whole stateful setup with keeping a version file in the repo and having to create PRs to update it - which will just result in more maintenance effort for us.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The sync PR description also says that it's perfectly safe to close a sync PR and wait for the next one and with this change it's no longer true, which will create problems for translators.

The description of the sync PR should also be updated to say that sync PRs are generated when there's an untranslated release and no pending sync PR (rather than in regular intervals as until now) so that they know when to expect one.

strategy:
# In the context matrix strategy, fail-fast means, if one of the jobs
# fails,the rest of the jobs will be canceled. In our case, this can
Expand All @@ -36,7 +58,7 @@ jobs:
- zh-chinese
steps:
- name: Fetch translation repository
uses: actions/checkout@v2
uses: actions/checkout@v4
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does the PR depend on this? It seems like it's an independent change so it should be at least a separate commit. Or even a separate PR.

with:
token: ${{ secrets.PAT }}
repository: ${{ env.GITHUB_REPOSITORY_OWNER }}/${{ matrix.repos }}
Expand All @@ -55,7 +77,7 @@ jobs:
git fetch english develop

- name: Fetch main Solidity repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
repository: ethereum/solidity
fetch-depth: 0
Expand All @@ -64,7 +86,7 @@ jobs:
path: solidity/

- name: Fetch bot's repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
repository: ${{ github.repository }}
Expand Down Expand Up @@ -112,9 +134,9 @@ jobs:
run: |
rm -rf bot/

- name: Create Pull Request
- name: Create Sync Pull Request
if: ${{ steps.bot-config.outputs.bot_disabled == 'false' && steps.check-sync-branch.outputs.branch_exists == 'false' }}
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v6
with:
path: translation/
token: "${{ secrets.PAT }}"
Expand All @@ -127,3 +149,25 @@ jobs:
labels: "${{ join(fromJSON(steps.bot-config.outputs.pr_labels)) }}"
assignees: ${{ env.assignee }}
reviewers: ${{ env.reviewer }}

- name: Fetch Solidity translation repository
uses: actions/checkout@v4
Copy link
Collaborator

Choose a reason for hiding this comment

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

This will fetch bot's repository, not the translation's repository.


- name: Update Solidity version
run: |
echo ${{ needs.checkSolidityRelease.outputs.latest_release }} > latest_solidity.release

- name: Create Pull Request to update Solidity version
uses: peter-evans/create-pull-request@v6
with:
token: "${{ secrets.PAT }}"
add-paths: latest_solidity.release
commit-message: Update Solidity release version to ${{ needs.checkSolidityRelease.outputs.latest_release }}
committer: "${{ env.BOT_USERNAME }} <${{ env.BOT_EMAIL }}>"
author: "${{ env.BOT_USERNAME }} <${{ env.BOT_EMAIL }}>"
title: Update Solidity release version to ${{ needs.checkSolidityRelease.outputs.latest_release }}
body: |
This PR updates the latest Solidity release version to ${{ needs.checkSolidityRelease.outputs.latest_release }}

Auto-generated by ${{ env.BOT_USERNAME }}
branch: solidity-release-updates
1 change: 1 addition & 0 deletions latest_solidity.release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.8.24