You may encounter this error in the “Cancel Previous Runs” step of your workflow:
Error: Resource not accessible through integration
This cryptic message often leaves developers scratching their heads. What resource? What integration? The error is caused by running a GitHub action in the .github/workflows/update-preview-deps.yml
file.
name: "Update Preview Dependencies (feat/v2)"
on:
schedule:
- cron: "15 */3 * * *" # every three hours
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.9.1
with:
access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v2.3.5
with:
ref: 'feat/v2-ci'
# ... (rest of the workflow steps)
The explanation
This error typically occurs when the GitHub token you’re using doesn’t have enough permissions to access the resources it needs. But sometimes, the issue can be more fundamental. Check if the feat/v2-ci
branch exists in the repository and fix it.
The solution
1. Check branch’s existence in our repo
Copy, paste, and execute the following command in your terminal:
branch_name="feat/v2"
function check_branch {
local branch_name="$1"
if git rev-parse --verify --quiet refs/heads/"$branch_name" >/dev/null 2>&1; then
echo -e "\n\e[32mBranch $branch_name exists.\e[0m\n"
else
echo -e "\n\e[31mBranch $branch_name does not exist.\e[0m\n"
fi
}
check_branch "$branch_name"
If you see Branch feat/v2 does not exist
, continue. If you see Branch feat/v2 exists
, push the branch and continue with the GitHub Actions execution.
2. Pull the missing branch from template
git fetch git@github.com:medusajs/medusa-starter-default.git feat/v2:feat/v2
You should see:
From github.com:medusajs/medusa-starter-default
* [new branch] feat/v2 -> feat/v2
3. Switch branch & push
git switch feat/v2 && git push origin feat/v2
4. Test GitHub Action
Go to GitHub and run Action “Update Preview Dependencies (feat/v2)” by clicking on the “Run Workflow” button.
Conclusion
The “resource not accessible through integration” error can be frustrating, but it’s often due to missing branches or insufficient permissions. For MedusaJS backends, ensure the necessary branches exist and your GitHub token has the right permissions. Happy coding!
Top comments (0)