Comments (6)
@luludan v2 happens to fix the issue you were hitting. V2 fetches the specific SHA rather than the ref.
This just works:
on:
pull_request:
branches:
- master
types: [opened, synchronize, closed]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
from checkout.
hi @luludan try to use another ref, by default, actions/checkout
uses ${{ github.ref }} which referes to something like: refs/pull/#/merge
an example, referencing another ref:
- uses: actions/checkout@v1
with:
ref: refs/heads/${{ github.head_ref }} # it could be ${{ github.base_ref }} also
from checkout.
i'll play around with this, i think i might know a way.
if you have the on:
syntax handy, please provide
from checkout.
hi @ericsciple thanks for your support,
here is a sample of .yml
:
name: Build
on:
pull_request:
branches:
- master
types: [opened, synchronize, closed]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Git Checkout PR Ref
if: github.event.action != 'closed'
uses: actions/checkout@v1
- name: Git Checkout Base Ref
if: github.event.pull_request.merged == true
uses: actions/checkout@v1
with:
ref: refs/heads/${{ github.base_ref }}
from checkout.
@ericsciple I got an issue when using goveralls, mattn/goveralls#150
And I think it's because checkout fetches the specific SHA rather than the ref, however goveralls gets the wrong sha:
if os.Getenv("GITHUB_EVENT_NAME") == "pull_request" {
ghPR := getGithubEvent()["pull_request"].(map[string]interface{})
ghHead := ghPR["head"].(map[string]interface{})
commitRef = ghHead["sha"].(string)
}
This can be fixed by using ref: ${{ github.event.pull_request.head.sha }}
, but i do not want to use it when push to master. Any advice to fix this issue?
from checkout.
@fezho you can add event check:
steps:
- uses: actions/checkout@v2
name: Checkout PR
if: github.event_name == 'pull_request'
with:
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/checkout@v2
name: Checkout Branch
if: github.event_name == 'push'
from checkout.
Related Issues (20)
- Unable to clone my other private repo's which i own from my private repository in github actions workflow
- Lack of support for GITHUB_SERVER_URL with subpath
- Infinite loop when git push
- PAT based access to different account not working in github actions
- inadequate documentation on "filter" option
- Error relocating /__e/node20_alpine/bin/node: secure_getenv: symbol not found HOT 1
- Заблокировать перевод по номеру телефона. Сбербанк
- 'actions/checkout@v4' with LFS fails because of double auth header HOT 1
- New
- 2 segunda
- Support LFS include/exclude HOT 1
- checkout fails when called from reusable workflows HOT 2
- https://github.com/actions/checkout/issues/new
- actions/checkout fails on git repos that use SHA256 HOT 1
- Exit code 128 (repository not found) eventhough the repo exists. HOT 1
- V4 hangs from time to time on fetching repository on GitHub ARC
- Not always working on private repos HOT 1
- Validador
- Checkout v4 Fails On Windows Server 2019 HOT 2
- Feature Request: Retry on network errors
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from checkout.