Skip to content

Merge pull request #11 from moT01/test/auto-merge-pr #25

Merge pull request #11 from moT01/test/auto-merge-pr

Merge pull request #11 from moT01/test/auto-merge-pr #25

# This action creates a PR on the freeCodeCamp repo to update the i18n-curriculum submodule.
name: Update i18n-curriculum Submodule
on:
workflow_dispatch:
push:
branches:
- main
env:
GITHUB_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_PAT }}
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_SERVICE_TOKEN }}
CROWDIN_API_URL: 'https://freecodecamp.crowdin.com/api/v2/'
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID_CURRICULUM }}
jobs:
check-pr-title:
runs-on: ubuntu-22.04
outputs:
run_update: ${{ steps.check.outputs.run_update }}
steps:
- name: Check PR Title
id: check
uses: actions/github-script@v6
with:
script: |
const pr_number = context.payload.head_commit.message.match(/#(\d+)/)[1];
const pr = await github.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pr_number
});
const author = pr.data.user.login;
if (author === 'camperbot') {
return { run_update: 'true' };
} else {
return { run_update: 'false' };
}
update-i18n-curriculum-submodule:
name: Update i18n-curriculum Submodule
needs: check-conditions

Check failure on line 43 in .github/workflows/update-submodule.yml

View workflow run for this annotation

GitHub Actions / Update i18n-curriculum Submodule

Invalid workflow file

The workflow is not valid. .github/workflows/update-submodule.yml (Line: 43, Col: 12): Job 'update-i18n-curriculum-submodule' depends on unknown job 'check-conditions'.
runs-on: ubuntu-22.04
if: needs.check-conditions.outputs.run_update == 'true'
steps:
- name: Checkout Source Files
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
# Todo: Change to fcc repo after this is transferred
repository: 'moT01/fcc'
token: ${{ secrets.CROWDIN_CAMPERBOT_PAT }}
submodules: true
- name: Ensure correct submodule path and initialization
run: |
git submodule sync
git submodule update --init --recursive
- name: Update submodule
run: |
git config --global user.email "${{ secrets.ACTIONS_CAMPERBOT_EMAIL }}"
git config --global user.name "camperbot"
git checkout -b chore/update-i18n-curriculum-submodule
git submodule update --remote i18n-curriculum
cd i18n-curriculum && SUBMODULE_HASH=$(git rev-parse --short HEAD) && cd ..
git add .
git commit -m "chore(curriculum): Update i18n-curriculum submodule to $SUBMODULE_HASH"
git push -u origin chore/update-i18n-curriculum-submodule -f
- name: Create PR
uses: freecodecamp/crowdin-action@main
env:
PLUGIN: 'pull-request'
GH_TOKEN: ${{ secrets.CROWDIN_CAMPERBOT_PAT }}
BRANCH: 'chore/update-i18n-curriculum-submodule'
# Todo: Change to fcc repo after this is transferred
REPOSITORY: 'moT01/fcc'
BASE: 'main'
TITLE: 'chore(i18n,learn): update i18n-curriculum submodule'
BODY: 'This PR was opened auto-magically by Camperbot.'