2021-01-21 03:28:19 +07:00
name : UncivBot
2021-01-24 04:47:11 +07:00
on :
issue_comment :
workflow_dispatch :
2021-01-21 03:28:19 +07:00
jobs :
2022-03-09 20:03:40 +07:00
prepare_version_for_rollout :
if : github.event_name == 'issue_comment' && (github.event.comment.body == 'summary' || github.event.comment.body == 'prepare version') && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association)
# This is the only place I could find an apparent list of valid author associations. Also, at least they're not case-sensitive: https://docs.github.com/en/graphql/reference/enums#commentauthorassociation https://docs.github.com/en/actions/learn-github-actions/expressions#contains
runs-on : ubuntu-latest
steps :
2023-03-06 20:24:07 +07:00
- uses : actions/checkout@v3
2022-03-09 20:03:40 +07:00
- uses : actions/setup-node@v2
- name : Generate new buildConfig.kt and changelog.md files
run : |
npm i @octokit/rest
node .github/workflows/incrementVersionAndChangelog.js
2023-06-04 03:04:24 +07:00
2022-03-09 20:03:40 +07:00
rm -rf node_modules # Now we need to remove extraneous node.js parts before commit
rm package-lock.json
rm package.json
2023-06-04 03:04:24 +07:00
2022-03-09 20:03:40 +07:00
- name : Create new branch with changes
2023-06-04 03:04:24 +07:00
uses : EndBug/add-and-commit@v9 # You can change this to use a specific version.
2022-03-09 20:03:40 +07:00
with :
new_branch : version_rollout
2022-03-14 16:47:04 +07:00
message : 'Bump version and create initial changelog entry'
2022-03-09 20:03:40 +07:00
- name : Add translation PRs to the new branch, and PR the new branch to master
2023-06-04 03:04:24 +07:00
run : |
2022-03-09 20:03:40 +07:00
npm i @octokit/rest
node .github/workflows/mergeTranslations.js ${{ secrets.ACTIONS_ACCESS_TOKEN }} ${{ github.event.issue.number }} version_rollout
2023-06-04 03:04:24 +07:00
2022-03-09 20:03:40 +07:00
merge_translations :
if : github.event_name == 'workflow_dispatch' || (github.event.comment.body == 'merge translations' && contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.comment.author_association))
# This is the only place I could find an apparent list of valid author associations. Also, at least they're not case-sensitive: https://docs.github.com/en/graphql/reference/enums#commentauthorassociation https://docs.github.com/en/actions/learn-github-actions/expressions#contains
runs-on : ubuntu-latest
steps :
2023-03-06 20:24:07 +07:00
- uses : actions/checkout@v3
2022-03-09 20:03:40 +07:00
- uses : actions/setup-node@v2
- name : Add translation PRs to the new branch, and PR the new branch to master
# SO, the story is that when using the default access token you CANNOT merge PRs from forks.
# _Badly_ documented in multiple places, including here: https://docs.github.com/en/actions/reference/authentication-in-a-workflow
# To get around this, we created a Personal Access Token,
# put it as one of the secrets in the repo settings (https://github.com/yairm210/Unciv/settings/secrets/actions),
# and use that instead.
2023-06-04 03:04:24 +07:00
run : |
2022-03-09 20:03:40 +07:00
npm i @octokit/rest
node .github/workflows/mergeTranslations.js ${{ secrets.ACTIONS_ACCESS_TOKEN }} ${{ github.event.issue.number }} translations