Home >Development Tools >git >how to get repo name in github actions
This article explains how to retrieve the name of the current repository when running GitHub Actions. It provides the syntax and demonstrates how to use the repository name within a GitHub action workflow.
When running GitHub Actions, you can retrieve the current repository's name using the repository
attribute within the GitHub context. The GitHub context is a special object that provides access to various information about the current workflow run, including the repository name.
The syntax for accessing the repo name within a GitHub action workflow is:
<code>${{ github.repository }}</code>
<code>name: Example workflow on: push: branches: - main jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - run: echo ${{ github.repository }}</code>
To use the repo name in GitHub Actions, you can use the repository
attribute within the GitHub context. For example, you could use it to set a variable or to dynamically include the repository name in your scripts.
You can dynamically include the repository name in your GitHub action scripts using the repository
attribute within the GitHub context. For example, you could use it to create a file with a name that includes the repository name.
The above is the detailed content of how to get repo name in github actions. For more information, please follow other related articles on the PHP Chinese website!