## 事象 以下のように [[upload-pages-artifact]]や[[deploy-pages]]を使って[[GitHub Actions]]から[[GitHub Pages]]にデプロイしようとする。 ```yaml on: push: tags: - "*" jobs: deploy-docs: runs-on: ubuntu-latest permissions: contents: read pages: write id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - uses: actions/checkout@v3 - uses: actions/configure-pages@v3 - uses: actions/upload-pages-artifact@v2 with: path: 'docs' - uses: actions/deploy-pages@v2 id: deployment ``` とエラーになる。 ```error Tag "20231022.1" is not allowed to deploy to github-pages due to environment protection rules. ``` ## 原因 [[GitHub Pages]]が該当タグを許可していないから。 ![[Pasted image 20231022131747.png]] ![[Pasted image 20231022131841.png]] `Deployment branches and tags`が`main`のみになっているので、`main`ブランチでないアクションはエラーになる。 ## 解決方法 `Deployment branches and tags`を`No restriction`にする。 ![[Pasted image 20231022131959.png]] 恐らくこれで問題ない。 ## 参考 - [Security Considerations](https://github.com/actions/deploy-pages#security-considerations)