varunsridharan / action-github-workflow-sync

Github Action To Sync Github Action's Workflow Files Across Repositories
https://github.com/marketplace/actions/github-workflow-sync
MIT License
60 stars 16 forks source link

Contents is not getting updated once the files are synced and pushed to target repository #22

Open swathida-byte opened 1 year ago

swathida-byte commented 1 year ago

@varunsridharan Once the file is synced and updated in the target repository and when the changes are made in the script and updated and when the changes are pushed to the target repository it's not getting updated.

For example: abc.sh in beginning echo "hi" abc.sh in target repo echo "hi"

abc.sh after updating echo "hello" abc.sh in target repo after updating echo "hi"

workflow file used


on:
  push:
    branches:
      - "main"
env:
  DRY_RUN: false
  REPOSITORIES: |
    QE/yarn-qe@github-actions-poc
  WORKFLOW_FILES: |
    yarn-qe/approval.yaml=.github/workflows/pr-approval.yaml
    yarn-qe/qe-check.yaml=.github/workflows/qe-check.yaml
    yarn-qe/qe-ci-gate-qe-gate.yaml=.github/workflows/qe-ci-gate-qe-gate.yaml
    .github/qaas-jobs/static-analysis.sh=.github/static-analysis.sh
    .github/qaas-jobs/commit_message_check.sh=.github/commit_message_check.sh
    .github/qaas-jobs/docker-build-system_test.sh=.github/docker-build-system_test.sh
    .github/qaas-jobs/docker-build-temp-image-system_test.sh=.github/docker-build-temp-image-system_test.sh
jobs:
  Github_Workflow_Sync:
    runs-on: [re-centos7]
    steps:
      - name: Fetching Local Repository
        uses: actions/checkout@v2
      - name: Running Workflow Sync
        uses: Kitchen/RE-thirdparty-actions/actions/workflow-sync@main
        with:
          DRY_RUN: ${{ env.DRY_RUN }}
          REPOSITORIES: ${{ env.REPOSITORIES }}
          WORKFLOW_FILES: ${{ env.WORKFLOW_FILES }}
          GITHUB_TOKEN: ${{ secrets.RE_JENKINS_GH_USER_TOKEN }}
          PULL_REQUEST: true
          GIT_URL: ***
          COMMIT_MESSAGE: "Sync workflow files | Triggered by Kitchen/RE-github-workflows"```
varunsridharan commented 1 year ago

@swathida-byte can you please provide the action's log and what kind of error it states ?

Also are you trying to update the file from the master repository where all the files are saved ? or are you using to update it from secondary repository to master ?

swathida-byte commented 1 year ago

I'm trying to update file from master where all files are saved

varunsridharan commented 1 year ago

@swathida-byte I tried multiple times in my dev env, but it works every time.

Without having access to GitHub action's log, I can't help. Please do share the actions log to assist you furthermore.

swathida-byte commented 1 year ago
    ✔  .github/QE/qaas-jobs/docker-build-temp-image-system_test.sh => .github/docker-build-temp-image-system_test.sh

  ✔  [github-actions-poc 31b7a39] Sync workflow files | Triggered by **/***
   3 files changed, 16 insertions(+)
   create mode 100644 .github/workflows/pr-approval.yaml
  Git Commit & Push Log
  ---------------------------------------------------
  /usr/local/bin/git push *****.git
  To https://***/**/qe.git
   ! [remote rejected] github-actions-poc -> github-actions-poc (refusing to allow a Personal Access Token to create or update workflow `.github/workflows/pr-approval.yaml` without `workflow` scope)
  error: failed to push some refs to 'https://**/**/qe.git'
  ---------------------------------------------------
swathida-byte commented 1 year ago

Can we use regex to mention branch names QE/yarn-qe@github-actions-poc as QE/yarn-qe@github.*

varunsridharan commented 1 year ago

@swathida-byte

Regards to the logs that you have shared, I can see a like

! [remote rejected] github-actions-poc -> github-actions-poc
(refusing to allow a Personal Access Token to create or update workflow `.github/workflows/pr-approval.yaml` 
without `workflow` scope)

in which it clearly states that the access token you have given for the action to commit files requires workflow scope. Please check here 👉 on how to generate a personal access token with that scope https://github.com/varunsridharan/action-github-workflow-sync#personal-access-token-scope


Regards to 👇

Can we use regex to mention branch names QE/yarn-qe@github-actions-poc as QE/yarn-qe@github.*

No, this action currently does not support regex. But I do have plans to have support for it.

GitHub
GitHub - varunsridharan/action-github-workflow-sync: Github Action To Sync Github Action's Workflow Files Across Repositories
Github Action To Sync Github Action's Workflow Files Across Repositories - GitHub - varunsridharan/action-github-workflow-sync: Github Action To Sync Github Action's Workflow Files Across R...
swathida-byte commented 1 year ago

When can we expect that regex support release??

varunsridharan commented 1 year ago

When can we expect that regex support release??

I don't have any timeline for it, but this feature will be added for sure.

I am not sure what you mean by central repository. Can you share a map as you have set up this action ?

swathida-byte commented 1 year ago

can you add regex feature, and after that I guess we can close that issue or should I raise one more request for tracking the same