minisauras icon indicating copy to clipboard operation
minisauras copied to clipboard

Ability to use other branches

Open Descent098 opened this issue 4 years ago • 8 comments

Currently minisauras only allows for a pull request to master to be generated. There are two possible solutions:

  1. Allow a config value for the branch to open the PR to. For example a config value called branch
  2. Keep all the files in the working dir after running so they can be auto-commited using another action i.e.
name: Minify JS and CSS on pages branch

on:
  push:
    branches:
      - gh-pages

jobs:
  build-deploy:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v2
        with:
          token: ${{ secrets.PERSONAL_TOKEN }}
    
      - name: minisauras
        uses: TeamTigers/[email protected]
        env:
          GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}
        id: dir
        with:
          directory: './' ## minify all files under root directory

      - name: Auto committing minified files
        uses: stefanzweifel/git-auto-commit-action@v4
        with:
          commit_message: "Github Action: Auto Minified JS and CSS files"
          branch: gh-pages

Descent098 avatar Oct 07 '20 01:10 Descent098

@Descent098 Can you help me set this token and secret thing?

I read the steps but I am not able to configure Minisauras properly.

yash982000 avatar Aug 19 '21 11:08 yash982000

Hello @Descent098,

Thank you for the suggestion. We hope to bring support to other branches in our next release very soon.

Thank you.

Teamtigers256 avatar Aug 20 '21 05:08 Teamtigers256

@Teamtigers256 That's great to hear, thanks!. @yash982000 Check this out for details on auth layer for actions, the above setup is custom and likely won't work for you: https://docs.github.com/en/actions/reference/authentication-in-a-workflow

Descent098 avatar Aug 20 '21 05:08 Descent098

@Teamtigers256 That's great to hear, thanks!. @yash982000 Check this out for details on auth layer for actions, the above setup is custom and likely won't work for you: https://docs.github.com/en/actions/reference/authentication-in-a-workflow

Yes, I saw this. I believe GITHUB_TOKEN is the general thing that we pass. But, how does it authenticate our repo and workflow uniquely. For that, where do I need to put the personal access token?

yash982000 avatar Aug 20 '21 05:08 yash982000

@Teamtigers256 That's great to hear, thanks!. @yash982000 Check this out for details on auth layer for actions, the above setup is custom and likely won't work for you: https://docs.github.com/en/actions/reference/authentication-in-a-workflow

Yes, I saw this. I believe GITHUB_TOKEN is the general thing that we pass. But, how does it authenticate our repo and workflow uniquely. For that, where do I need to put the personal access token?

I did put the personal access token inside the secret named TOKEN.

I want to trigger this to run on every commit in the default branch.

What should my "ON" statement go like in the following code?

name: minisauras

on: [push]

jobs:
  read:
    runs-on: ubuntu-18.04

    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - name: minisauras
      uses: TeamTigers/[email protected]
      env:
        GITHUB_TOKEN: ${{ secrets.TOKEN }}
      id: dir
      with:
        directory: './' ## minify all files from root directory

Much help is appreciated.

yash982000 avatar Aug 20 '21 06:08 yash982000

@yash982000 I haven't used this project in a while so I don't remember what scope it needs.

I would personally use the built-in ${{ secrets.GITHUB_TOKEN }} if you just need it for a repo just you are using.

The only reason I used that ${{ secrets.PERSONAL_TOKEN }} or in your case ${{ secrets.TOKEN }} was because this pipeline is part of an organization project and pushes need to be made by the organization account, not my personal account. You should go that route if you have more than one person who needs to be able to trigger the pipeline.

Other than that there's not a whole lot of other troubleshooting I can do, just make sure the token is setup properly, and that you have it in the correct spot as per the guide and the https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token guide.

Descent098 avatar Aug 20 '21 19:08 Descent098

@yash982000 I haven't used this project in a while so I don't remember what scope it needs.

I would personally use the built-in ${{ secrets.GITHUB_TOKEN }} if you just need it for a repo just you are using.

The only reason I used that ${{ secrets.PERSONAL_TOKEN }} or in your case ${{ secrets.TOKEN }} was because this pipeline is part of an organization project and pushes need to be made by the organization account, not my personal account. You should go that route if you have more than one person who needs to be able to trigger the pipeline.

Other than that there's not a whole lot of other troubleshooting I can do, just make sure the token is setup properly, and that you have it in the correct spot as per the guide and the https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token guide.

@Descent098 Yes, I did that thing. Even the logs are showing perfectly fine. But, the pull request is not opened and minification is not done as well.

yash982000 avatar Aug 25 '21 15:08 yash982000

name: minisauras

on: [push]
   #schedule:
    # * is a special character in YAML so you have to quote this string
   # - cron:  '* * * * *'
#permissions:
#  contents: read
#  pull-requests: write

jobs:
  read:
    runs-on: ubuntu-18.04

    steps:
    - name: Checkout
      uses: actions/checkout@v2
    - name: minisauras
      uses: TeamTigers/[email protected]
      env:
        PERSONAL_TOKEN: ${{ secrets.ACCESS_TOKEN }}
      id: dir
      with:
        directory: './' ## minify all files from root directory

Here goes my whole code.

And here is the screenshot when the workflow runs which also says success but no minification.

image

yash982000 avatar Aug 25 '21 15:08 yash982000