chore(release): version packages on main branch #138
Workflow file for this run
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
name: Update changeset PRs (yarn lock regen) | |
on: | |
push: | |
branches: | |
- 'changeset-release/**' | |
# enforce only one release action per release branch at a time | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
prev-commit: | |
name: Verify previous commit | |
runs-on: ubuntu-latest | |
outputs: | |
valid: ${{ steps.prev-commit.outputs.valid }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
# We do not want an infinite loop; therefore, we are checking if the previous | |
# commit was created by this action. | |
- name: Get previous commit message | |
id: prev-commit | |
run: | | |
echo "valid=$(if [[ $(git log -1 --pretty=%B HEAD) != 'chore: update yarn.lock' ]]; then echo 'true'; else echo 'false'; fi)" >> $GITHUB_OUTPUT | |
update-and-commit-files: | |
name: Update and commit files | |
needs: prev-commit | |
if: needs.prev-commit.outputs.valid == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate token | |
id: generate-token | |
uses: actions/create-github-app-token@31c86eb3b33c9b601a1f60f98dcbfd1d70f379b4 # v1.10.3 | |
with: | |
app-id: ${{ vars.JANUS_IDP_GITHUB_APP_ID }} | |
private-key: ${{ secrets.JANUS_IDP_GITHUB_APP_PRIVATE_KEY }} | |
- name: Checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
- name: Setup Node.js | |
uses: actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4 | |
with: | |
node-version-file: '.nvmrc' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
# We want to commit the yarn.lock changes | |
run: yarn install --no-immutable | |
- name: Amend previous commit | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: 'chore: update yarn.lock' | |
file_pattern: yarn.lock |