fix(deps): update rust crate serde_json to v1.0.135 (#161) #216
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- 'translations' | |
workflow_dispatch: | |
jobs: | |
create-pull-request: | |
permissions: | |
pull-requests: write | |
checks: write | |
issues: write | |
runs-on: ubuntu-latest | |
outputs: | |
create-pr: ${{ steps.create-pr.outputs.result }} | |
steps: | |
- name: Create Pull Request | |
id: create-pr | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const translationsOwner = "metabrainz" | |
console.log(context) | |
const { repo, owner } = context.repo; | |
const { sha } = context; | |
const { head, base } = { base: "main", head: translationsOwner + ":translations", } | |
if (owner != translationsOwner) { | |
return | |
} | |
const main = | |
await github.rest.repos.getBranch({ | |
owner, | |
repo, | |
branch: "main" | |
}); | |
if (sha == main.data.commit.sha) { | |
return | |
} | |
const pulls = await github.rest.pulls.list({ owner, repo, head, base, state: "open" }) | |
console.log(pulls.data) | |
if (pulls.data.length == 0) { | |
console.log("Creating PR!") | |
const result = await github.rest.pulls.create({ | |
title: 'chore(translations): Update translations', | |
owner, | |
repo, | |
head, | |
base, | |
body: [ | |
'**This PR is auto-generated**', | |
'', | |
'When adding a new language, please make sure to add the language to Cargo.toml', | |
].join('\n') | |
}); | |
github.rest.issues.addLabels({ | |
owner, | |
repo, | |
issue_number: result.data.number, | |
labels: ['translations'] | |
}); | |
return "created-pr" | |
} else { | |
console.log("PR exists, skipping!") | |
} | |
test: | |
uses: ./.github/workflows/ci.yml | |
permissions: | |
checks: write | |
issues: write | |
needs: create-pull-request | |
if: needs.create-pull-request.outputs.create-pr == 'created-pr' |