Skip to content

Commit

Permalink
Always fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
dsotirakis committed Oct 3, 2023
1 parent 95099cd commit dfc3f13
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,8 @@ const pkg = getPackageJson();
await runInWorkspace('git', ['commit', '-a', '-m', commitMessage.replace(/{{version}}/g, newVersion)]);
}

// now go to the actual branch to perform the same versioning
if (isPullRequest) {
// First fetch to get updated local version of branch
await runInWorkspace('git', ['fetch']);
}
// First fetch to get updated local version of branch
await runInWorkspace('git', ['fetch']);
await runInWorkspace('git', ['checkout', currentBranch]);
await runInWorkspace('npm', ['version', '--allow-same-version=true', '--git-tag-version=false', current]);
console.log('current 2:', current, '/', 'version:', version);
Expand Down

7 comments on commit dfc3f13

@linxiano
Copy link

Choose a reason for hiding this comment

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

Seems like this new update causes my pipeline to fail:
image

I am using a PAT for my GITHUB_TOKEN for my action.

@phips28
Copy link
Owner

@phips28 phips28 commented on dfc3f13 Oct 3, 2023

Choose a reason for hiding this comment

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

@dsotirakis
Copy link
Contributor Author

@dsotirakis dsotirakis commented on dfc3f13 Oct 3, 2023

Choose a reason for hiding this comment

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

Oh - I am using a Github App for that and works for me, sorry about that :/

@dsotirakis
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@linxiano πŸ‘‹
Could you please send me a snippet of your GHA configuration? I am just curious 😁

@linxiano
Copy link

Choose a reason for hiding this comment

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

@linxiano πŸ‘‹ Could you please send me a snippet of your GHA configuration? I am just curious 😁

Sure, its used as a reusable workflow. main branch is protected so a PAT is used to allow the bump version to push to the main branch without needing a PR.

name: πŸ›« Build & Deploy Node Packages

on:
  workflow_call:
    inputs:
      node-version:
        description: The version of node to be used
        required: false
        type: string
        default: 20.x

  workflow_dispatch:
    inputs:
      node-version:
        description: The version of node to be used
        required: false
        type: string
        default: 20.x


jobs:
  bump-version:
    name: 'πŸ’‰ Bump Version & Publish'
    runs-on: ubuntu-latest
    permissions:
      contents: write
      packages: write
    env:
      NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      GITHUB_TOKEN: ${{ secrets.PA_TOKEN }}

    steps:
      - name: 'Checkout source code'
        uses: 'actions/checkout@v4'
        with:
          persist-credentials: false
          ref: ${{ github.ref }}

      - name: 'cat package.json'
        run: cat ./package.json

      - name: 'Automated Version Bump'
        id: version-bump
        uses: 'phips28/gh-action-bump-version@master'
        with:
          minor-wording: '#feature,#minor'
          major-wording: '#breaking-change,#major'
          patch-wording: '#patch'
          tag-prefix: 'v'
          commit-message: '[skip actions] CD: Bump version to {{version}}'

      - name: 'cat package.json'
        run: cat ./package.json

      - name: 'Setup Node.js and yarn'
        uses: actions/setup-node@v3
        with:
          node-version: ${{ inputs.node-version }}
          registry-url: 'https://npm.pkg.github.com'
          scope: '@laerdal-medical'
      - run: yarn --prefer-offline

      - name: Build
        run: yarn build 

      - name: Publish
        run: yarn publish
        

@petehl
Copy link

@petehl petehl commented on dfc3f13 Oct 18, 2023

Choose a reason for hiding this comment

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

Oh - I am using a Github App for that and works for me, sorry about that :/

@dsotirakis - How are you using a GitHub App for the token?

I've tried using a token from a Github app that has write permission instead of a PAT , however it fails when the branch is protected. (it works when the branch is not protected)

@petehl
Copy link

@petehl petehl commented on dfc3f13 Oct 18, 2023

Choose a reason for hiding this comment

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

Oh - I am using a Github App for that and works for me, sorry about that :/

@dsotirakis - How are you using a GitHub App for the token?

I've tried using a token from a Github app that has write permission instead of a PAT , however it fails when the branch is protected. (it works when the branch is not protected)

Actually I figured it out. I had to allow the Github App to bypass certain branch protections at more than 1 place.

Please sign in to comment.