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

support: Error: Unable to resolve actions. Cannot access repositories 'peaceiris/actions-gh-pages' #1083

Closed
3 tasks done
ashokvaddevalli opened this issue Jun 21, 2024 · 12 comments
Assignees
Labels

Comments

@ashokvaddevalli
Copy link

Checklist

  • I am using the latest version of this action.
  • I have read the latest README and followed the instructions.
  • I have read the latest GitHub Actions official documentation and learned the basic spec and concepts.

Describe your question

We are facing issues using this action on Github Enterprise.

Error: Unable to resolve actions. Cannot access repositories 'peaceiris/actions-gh-pages'. Enable access using Settings in the Action repository. See https://docs.github.com/[email protected]/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#allowing-access-to-components-in-an-internal-repository for more information.

Relevant links

Public repository:
YAML config:
YAML workflow:
 - name: Get Allure history
        uses: actions/checkout@v3
        if: always()
        continue-on-error: true
        with:
          ref: gh-pages
          path: gh-pages
      - name: Allure report action
        uses: simple-elf/allure-report-action@58e6590adf6d8f196a0d771bf8a00e6921086a62
        if: always()
        with:
          allure_results: allure-report
          allure_history: allure-history
          keep_reports: 10
      - name: Deploy Allure report to GitHub Pages
        uses: peaceiris/actions-gh-pages@v4
        if: always()
        with:
          github_token: ${{ secrets.GHE_TOKEN }}
          publish_branch: gh-pages
           publish_dir: allure-history

Relevant log output

Getting action download info
Error: Unable to resolve actions. Cannot access repositories 'peaceiris/actions-gh-pages'. Enable access using Settings in the Action repository. See https://docs.github.com/[email protected]/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#allowing-access-to-components-in-an-internal-repository for more information.

Additional context.

No response

@ashokvaddevalli
Copy link
Author

ashokvaddevalli commented Jun 24, 2024

Hi @peaceiris
We are using GitHub Enterprise, and we can't enable all actions due to security reasons. We are enabling the required actions as per request. We are enabled this action 4f9cc66 but we are facing the issue. Any dependent actions for this action?

image

@peaceiris
Copy link
Owner

We must use the same declaration for the workflow file and allow list, I expect.

When we pin a custom action in the allow list by a commit hash, we need to use the commit hash in our YAML workflow file.

@ashokvaddevalli
Copy link
Author

ashokvaddevalli commented Jun 24, 2024

I tried using commit has only, but the issue is the same.

image

@peaceiris
Copy link
Owner

peaceiris commented Jun 24, 2024

Ahh, it seems that we cannot override a policy managed by the enterprise. Could you ask the enterprise owners to add this action to the allow list using the commit hash?

https://docs.github.com/en/[email protected]/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-github-actions-settings-for-a-repository#allowing-select-actions-to-run

Note

You might not be able to manage these settings if your organization has an overriding policy or is managed by an enterprise that has overriding policy. For more information, see "Disabling or limiting GitHub Actions for your organization" or "Enforcing policies for GitHub Actions in your enterprise."

@ashokvaddevalli
Copy link
Author

ashokvaddevalli commented Jun 24, 2024

Hi,
This action is already enabled after my request, but I am facing this issue. We are using other actions, but we are not seeing this issue, and we are facing issues with using this action.
4f9cc66

@peaceiris
Copy link
Owner

Oh, sorry. I have no more idea about this...

Today, the official custom GitHub Action to deploy GitHub Pages is available. We can try it.

@ashokvaddevalli
Copy link
Author

Hi,
Using deploy-pages action, i have not seen publish_branch and publish_dir options.

  • name: Publish test report
    uses: peaceiris/actions-gh-pages@v3
    if: always()
    with:
    github_token: ${{ secrets.GITHUB_TOKEN }}
    publish_branch: gh-pages
    publish_dir: allure-history

@peaceiris
Copy link
Owner

Also, we need the actions/upload-pages-artifact to upload our publish_dir.

Here is an example workflow (not tested).

name: Pages

on:
  push:
    branches:
      - main

permissions:
  contents: read
  pages: write
  id-token: write

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Build
        run: build_something

      - name: Upload artifact
        uses: actions/upload-pages-artifact@v3
        with:
          path: "publish_dir"

  deploy:
    environment:
      name: github-pages
      url: ${{ steps.deployment.outputs.page_url }}
    runs-on: ubuntu-latest
    needs: build
    steps:
      - name: Deploy to GitHub Pages
        id: deployment
        uses: actions/deploy-pages@v4

@ashokvaddevalli
Copy link
Author

I am trying to publish allure reports, and we want access to previous reports as well. I am trying to use the below action.

name: Run tests and publish report
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

  - name: Set up JDK
    uses: actions/setup-java@v3
    with:
      distribution: zulu
      java-version: 17

  - name: Run tests
    run: ./gradlew clean test

  - name: Load test report history
    uses: actions/checkout@v3
    if: always()
    continue-on-error: true
    with:
      ref: gh-pages
      path: gh-pages

  - name: Build test report
    uses: simple-elf/[email protected]
    if: always()
    with:
      gh_pages: gh-pages
      allure_history: allure-history
      allure_results: build/allure-results

  - name: Publish test report
    uses: peaceiris/actions-gh-pages@v3
    if: always()
    with:
      github_token: ${{ secrets.GITHUB_TOKEN }}
      publish_branch: gh-pages
      publish_dir: allure-history

@ashokvaddevalli
Copy link
Author

I have tried without gh-pages action and it is working fine.

  • name: Deploy Allure report to GitHub Pages
    if: always() # Execute even if previous steps fail
    run: |
    # Configure git
    git config --global user.name "${{ github.actor }}"
    git config --global user.email "${{ github.actor }}@se.com"

       # Checkout the gh-pages branch
       git fetch origin
       git checkout -B gh-pages origin/gh-pages
    
       # Copy the new report to the gh-pages branch
       mkdir -p auto_test_report/${{ github.run_number }}  
       cp -r allure-report/index.html auto_test_report/${{ github.run_number }}
       # mkdir -p auto_test_report/latest
       cp -r allure-report/index.html auto_test_report/latest
    
       # Commit and push the changes
       git add auto_test_report/${{ github.run_number }}/index.html auto_test_report/latest/index.html
       git commit -m "Update Allure test report"
       git push origin gh-pages
     env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 
    

Copy link
Contributor

This issue has been LOCKED because of it being resolved!

The issue has been fixed and is therefore considered resolved.
If you still encounter this or it has changed, open a new issue instead of responding to solved ones.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 25, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants