how to use pat token to clone private repo through GitHub actions.? - css

name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout#v2
# Runs a single command using the runners shell
- name: terratest
run: echo Github pat token is ${{ secrets.TF_GITHUB_PAT }}
- name: checkout t2form-k8s repo
uses: actions/checkout#v2
with:
repository: harikalyank/t2form-k8s
token: ${{ secrets.TF_GITHUB_PAT }}
ref: master
The above one is my GH-workflow and it's getting failed to clone repo:t2form-k8s.
error: Warning: The save-state command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
Error: Input required and not supplied: token
I created Pat/secret token as well on repository level with name:TF_GITHUB_PAT

Related

GitHub action stalls on setup-r-dependencies#v2

This is cross posted on the RStudio Community site. I am using r-lib/setup-r-dependencies#v2 for a bookdown project on GitHub action. However, the job is stalling when pak tries to create a lock file. Here is an example run , and here is the workflow.
As you can see, eventually the job just times out.
The issue seems similar to this post. The solution there was to use the most current RSPM, but I believe that is already what I am using (I don't specify anything different in the workflow).
Any ideas on what might be causing this?
Edit: Here is the full yaml code for the workflow (linked above)
on:
push:
branches: [main, master]
workflow_dispatch:
name: bookdown
jobs:
bookdown:
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout#v2
- uses: r-lib/actions/setup-pandoc#v2
- uses: r-lib/actions/setup-r#v2
with:
use-public-rspm: true
- uses: r-lib/actions/setup-r-dependencies#v2
with:
cache-version: 1
- name: Cache bookdown results
uses: actions/cache#v2
with:
path: _bookdown_files
key: bookdown-${{ hashFiles('**/*Rmd') }}
restore-keys: bookdown-
- name: Build site
run: bookdown::render_book("index.Rmd", quiet = TRUE)
shell: Rscript {0}
- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/github-pages-deploy-action#4.1.4
with:
branch: gh-pages
folder: _book

Deploy ASP.NET Core on Server with Github Action

I'm using github actions to deploy my projects on my windows server using FTP
name: .NET
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout#v3
- name: Setup .NET
uses: actions/setup-dotnet#v2
with:
dotnet-version: 6.0.x
- name: Init Utilities
run: git submodule update --init
- name: Get Utilities
run: git submodule update --remote -f
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Publish
run: dotnet publish
- name: Deploy
uses: SamKirkland/FTP-Deploy-Action#4.0.0
with:
local-dir: LOCAL_DIR
server: SERVER
username: USERNAME
password: PASSWORD
dangerous-clean-slate: true
the problem is that I have to manually stop the server so the files could be uploaded.
but I don't want to stop the server manually. is there any way so I can force update the project without stoping the server or stop the server automatically?
You can add app_offline.htm to make your site offline. When publishing is complete, delete the app_offline.htm file.
Official doc: Taking Web Applications Offline with Web Deploy
You can refer the link to add app_offline.htm file when you delpoy the app.

Run Sendria (MailTrap) in a Github workflow to test mail delivery in a WordPress plugin

I like to test the mail functionally from a WordPress plugin via a Github Workflow and Sendria (MailTrap)
This is my working workflow:
# Based on https://github.com/wp-cli/scaffold-command/blob/f9bad3dd7224d5684d950d31c486df70905e386f/templates/plugin-github.mustache
name: WordPress Test
on: [push]
env:
WP_TESTS_DIR: /github/home/wp-tests/wordpress-tests-lib
WP_CORE_DIR: /github/home/wp-tests/wordpress
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: [7.2]
wordpress-version: [latest]
container:
image: junaidbhura/wp-tests:php-${{ matrix.php-version }}
services:
mysql:
image: mysql:5.7.27
env:
MYSQL_ROOT_PASSWORD: root
steps:
- name: Checkout repository
uses: actions/checkout#v1
- name: Install Composer dependencies
run: |
composer install --no-dev
composer global require "phpunit/phpunit=6.1.0"
composer global require "yoast/phpunit-polyfills=1.0.3"
- name: Install WordPress test suite
run: bash bin/install-wp-tests.sh wordpress_test root root mysql ${{ matrix.wordpress-version }}
- name: Tests
run: $HOME/.composer/vendor/bin/phpunit --config=phpunit-integration.xml
This workflow
checkout my plugin
install composer dependencies
install the WordPress test suite
run the Tests (which should contain mail tests)
Now I like to add Sendria to this flow by adding this action right above the first step:
- name: Start Sendira
uses: upgundecha/start-sendria-github-action#v1.0.0
with:
smtp-port: 1025
http-port: 1080
To test that Sendria is running I check the endpoint via curl with an additional step:
- name: Test
run: |
curl -LI http://127.0.0.1:1080
And this "Test" fails:
I tried the workflow locally with act where this step worked but have no idea how to get this working on Github.
I've also created a test repo on Github here.

Github actions Runner listener exited with error code null

In my server, if I run
sudo ./svc.sh status
I got this
It says status is active. But Runner listener exited with error code null
In my, Github accounts actions page runner is offline.
The runner should be Idle as far as I know.
This is my workflow
name: Node.js CI
on:
push:
branches: [ dev ]
jobs:
build:
runs-on: self-hosted
strategy:
matrix:
node-version: [ 12.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout#v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node#v1
with:
node-version: ${{ matrix.node-version }}
Here I don't have any build scripts because I directly push the build folder to Github repo.
How do I fix this error?
I ran into this issue when I first installed the runner application under $USER1 but configured it as a service when I was $USER2.
In the end, I ran cd /home/$USER1/actions-runner && sudo ./svc.sh uninstall to remove the service.
Changed the owner of the all files in the /home/$USER1/actions-runner/ by
sudo chown -R $USER2 /home/$USER1/actions-runner.
And ran ./config.sh remove --token $HASHNUBER (you can get this by following this page) to removed all the runner application.
I also removed it from github settings runner page.
In the end, I installed eveything again as the same user, and it worked out.
I ran into this same issue and it turned out to be a disk space problem. Make sure your server has enough allocated storage.

Github Actions: missing telegram token or user list

I'm trying to use Github Actions to send a Telegram message every time someone pushes to the master of repo. But using this action causes the following error and action fails:
missing telegram token or user list
Here is my yml file:
name: CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Telegram Notify
uses: appleboy/telegram-action#0.0.3
with:
to: ${{ secrets.TELEGRAM_CHAT_ID }}
token: ${{ secrets.TELEGRAM_TOKEN }}
message: |
An event occured in ${{ github.repository }} repository.
${{ github.event_name }}
I quite new in Github Actions. What should I do to fix this?
P.S: I've added telegram_token and telegram_chat_id to secrets section of repo.
Go to the repo settings and set the secrets for the TELEGRAM_CHAT_ID and the TELEGRAM_TOKEN. when setting the secrets for TELEGRAM_TOKEN make sure to send the queries to the Telegram Bot API using the bot token https://api.telegram.org/bot/METHOD_NAME, for example https://api.telegram.org/bot19023205:BNF-23dred1234ghIkl-dre4fdgr8nv1w4od/getMe

Resources