Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to use other branches #30

Open
Descent098 opened this issue Oct 7, 2020 · 8 comments
Open

Ability to use other branches #30

Descent098 opened this issue Oct 7, 2020 · 8 comments

Comments

@Descent098
Copy link

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/minisauras@v2.0.0
        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
@yash982000
Copy link

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

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

@Teamtigers256
Copy link

Hello @Descent098,

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

Thank you.

@Descent098
Copy link
Author

Descent098 commented Aug 20, 2021

@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

@yash982000
Copy link

@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
Copy link

@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/minisauras@v2.0.0
      env:
        GITHUB_TOKEN: ${{ secrets.TOKEN }}
      id: dir
      with:
        directory: './' ## minify all files from root directory

Much help is appreciated.

@Descent098
Copy link
Author

@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.

@yash982000
Copy link

@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
Copy link

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/minisauras@v2.0.0
      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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants