Let’s burn Hive in an alternative and lazy way: Tutorial using github actions and my code.

in Hive Learnerslast month


image.png

Banner created in chatGPT

  I am sharing this script, since it can help people to simplify their lives if they want to spend vp in burn posts/comments like @buildawhale do. I know that auto vote already exists in the fanbase at hive.vote and as a new function in Peakd (peakd.com/me/autovote). But there are some limitations, at least for me. If I add buildawhale there, every time that they post, it will spend all the vp in my required threshold, which is 80% usually. So it will always vote, their post is always 9:00 AM my local time. I start working around hive at the same time, and I always see my VP at this threshold, but sometimes I want to vote for other people and still keep 80% or something around. So I created something that only votes at the times I want, which I usually don't do since I am with kids most of the time around 00 UTC.

  I was offering for some people in private to add their accounts to my script, but I think it is better to provide a GitHub repo, which can be forked to a private GitHub of your choice. And this way, I also don't see the posting key. GitHub has a nice function to store passwords and other parameters called secrets, which are encrypted. Posting keys can be stored there safely. Another cool function is GitHub Actions, so the script can be run on GitHub every day at the time chosen by the user. Sometimes it has some delays, for example, when I run mine at 11:50 pm UTC it gets sometimes 1h delayed. It is a free scheduler, so there is a public queue for that.

  What do you need to do for that? First, have a GitHub account. Create that at https://github.com/. After a successful login, you can access my repo: https://github.com/rantree-hive/auto_voting_baw. And click in the fork button.


image.png
image.png

How to fork a github repository.

  After clicking "create fork," you will have this script in your personal GitHub repo. If I perform any update in my original repo, you will tell in your repo and you will choose to update it. Now the next steps is adding the parameters into the secrets of your newly forked repository. Go to "Settings", then "Secrets", and then "Actions". After that just "New repository secrets"


image.png

Settings of your copied repository to add secrets.

  Here you can add all the secrets that the program requires and the optionals if needed. The script requires at least one account to run, but you can add as many as you want. There are 3 mandatory secrets that should be added ACCOUNT_1_USERNAME, ACCOUNT_1_POSTING_KEY and ACCOUNT_1_VOTE_POST. The last one the input is 'true' or 'false'. If it is true it will vote the main post plus the burn comments. If you add 'false' it will vote only in the comments. That is an option that some people prefer when they don't want their voting trail followed in a burn. If you desire to add more accounts, just add 3 more secrets using the value for this other account and instead of 1 change for 2...3 ... and more numbers. Each secreted is added once.


image.png
image.png

Secrets added

  It should run now automatically every day at 11:50pm UTC after you enable it. Go to actions, click on the left side at "Hive Burn Post Voter" and Enable workflow. After that it is enabled, you can try it and run it before the chosen time. Just click "Run workflow". It should get a green mark. The default is to vote until the account's VP drops from 80%. You can always disable the workflow if you are just unhappy in the three dots.


image.png

Enabling workflow.


image.png

You Can Always disable the workflow.

  You can also customise other parameters as a new secret, if you want to replace buildawhale, just add another username under TARGET_AUTHOR secret. Also you can choose a different Voting power as a minimum instead of 80%. If you want to use 90% just add a secret MIN_VOTING_POWER value as '9000' . Also you can change the voting weight with VOTE_WEIGHT. The default is 100%, if you want to change to 90% just go to 9000 value. And last not mandatory secret HOURS_BACK. The default is 24 hours ago, so the latest post of buildawhale but you can change for 48h for example, with the value '48'.


image.png

Optional secrets

  The last parameter that you may be able to change is the UTC time, which is not possible to change through the secret. You would need to alter the code of .gitHub/workflows/hive_burn_voter.yml, you can edit any part of the code if you want and also check around. More specifically, line 5 of that script. That is the code for GitHub to start the workflow at that time. Right now it is -cron '50 23 * * *' , so the first is the minutes (50) and the second the hours (23 = 11). if you want to run at 5pm, replace the 50 with 0 and the 23 with 17. Easy right?


image.png

The workflow configuration file.

  Common questions answers: Your changes there won't reflect anything in my original repo, and my changes will reflect in your repo only if you want to synchronize it. Your posting key is securely encrypted at GitHub. They are only used in this same workflow file yml with the time. The script is simple; I am not capturing the secret anywhere and sending it somewhere. Even for you, the posting key won't be visible if you click to update the secret; you will be able to replace the value, but you don't know exactly what is being replaced. So if someone hacks your GitHub, they wouldn't see the posting key. Last but not least, please tell me any problems here, on GitHub, or via Discord.


Banner created in canva

image.png

  Estou compartilhando este script, pois ele pode ajudar as pessoas a simplificarem suas vidas se quiserem gastar VP em posts/comentários de destaque, como faz o @buildawhale. Sei que o voto automático já existe na comunidade do hive.vote e como uma nova função no Peakd (peakd.com/me/autovote). Mas existem algumas limitações, pelo menos para mim. Se eu adicionar o buildawhale lá, toda vez que ele postar, gastará todos os VP do meu limite necessário, que geralmente é de 80%. Então, ele sempre votará, mesmo que a postagem dele seja sempre às 9h da manhã, no meu horário local. Começo a trabalhar no Hive ao mesmo tempo e sempre vejo meus VP nesse limite, mas às vezes quero votar em outras pessoas e ainda manter 80% ou algo próximo disso. Então, criei algo que vota apenas nos horários que eu quero, o que geralmente não faço, já que estou com as crianças na maior parte do tempo por volta da meia-noite UTC.

  Eu estava oferecendo a algumas pessoas, em privado, a possibilidade de adicionar suas contas ao meu script, mas acho que é melhor fornecer um repositório no GitHub, que pode ser bifurcado para um GitHub privado de sua escolha. Dessa forma, também não vejo a chave de postagem. O GitHub tem uma função interessante para armazenar senhas e outros parâmetros, chamada de segredos, que são criptografados. As chaves de postagem podem ser armazenadas lá com segurança. Outra função interessante é o GitHub Actions, que permite que o script seja executado no GitHub todos os dias no horário escolhido pelo usuário. Às vezes, há alguns atrasos; por exemplo, quando executo o meu às 23h50 UTC, às vezes há um atraso de 1 hora. É um agendador gratuito, então existe uma fila pública para isso.

 O que você precisa fazer para isso? Primeiro, tenha uma conta no GitHub. Crie uma em https://github.com/. Após o login bem-sucedido, você pode acessar meu repositório: https://github.com/rantree-hive/auto_voting_baw. E clicar no botão de bifurcação.


image.png
image.png

Como fazer um fork de um repositório do GitHub.

  Após clicar em "criar fork", você terá este script em seu repositório pessoal do GitHub. Se eu realizar alguma atualização no meu repositório original, você será notificado no seu repositório e poderá optar por atualizá-lo. Agora, o próximo passo é adicionar os parâmetros aos segredos do seu novo repositório bifurcado. Vá para "Configurações", depois "Segredos" e, em seguida, "Ações". Depois disso, basta clicar em "Novo segredo do repositório".


image.png

Configurações do seu repositório copiado para adicionar segredos.

  Aqui você pode adicionar todos os segredos que o programa exige e os opcionais, se necessário. O script requer pelo menos uma conta para funcionar, mas você pode adicionar quantas quiser. Há 3 segredos obrigatórios que devem ser adicionados: ACCOUNT_1_USERNAME, ACCOUNT_1_POSTING_KEY e ACCOUNT_1_VOTE_POST. O último deve ser 'true' ou 'false'. Se for 'true', o programa votará na publicação principal e nos comentários de divulgação. Se você adicionar 'false', o programa votará apenas nos comentários. Essa é uma opção que algumas pessoas preferem quando não querem que seu histórico de votos seja rastreado em uma divulgação. Se desejar adicionar mais contas, basta adicionar mais 3 segredos usando o valor da outra conta e, em vez de 1, substituir por 2, 3 ou mais. Cada segredo é adicionado apenas uma vez.


image.png
image.png

Segredos adicionados

  Agora, após a ativação, o fluxo de trabalho deve ser executado automaticamente todos os dias às 23h50 UTC. Vá em Ações, clique em "Hive Burn Post Voter" no lado esquerdo e selecione Ativar fluxo de trabalho. Depois de ativado, você pode testá-lo e executá-lo antes do horário escolhido. Basta clicar em "Executar fluxo de trabalho". Ele deverá aparecer com uma marca verde. A configuração padrão é votar até que o VP da conta caia abaixo de 80%. Você sempre pode desativar o fluxo de trabalho se não estiver satisfeito com o resultado.


image.png

Habilitando o fluxo de trabalho.


image.png

Você sempre pode desativar o fluxo de trabalho.

 Você também pode personalizar outros parâmetros como um novo segredo. Se quiser substituir `buildawhale`, basta adicionar outro nome de usuário no segredo `TARGET_AUTHOR`. Além disso, você pode escolher um poder de voto mínimo diferente de 80%. Se quiser usar 90%, basta adicionar o valor '9000' ao segredo `MIN_VOTING_POWER`. Você também pode alterar o peso do voto com `VOTE_WEIGHT`. O padrão é 100%; se quiser alterar para 90%, basta definir o valor para 9000. E, por último, o segredo opcional `HOURS_BACK`. O padrão é de 24 horas atrás, ou seja, a última postagem do buildawhale, mas você pode alterar para 48 horas, por exemplo, com o valor '48'.


image.png

Segredos opcionais

  O último parâmetro que você pode alterar é o horário UTC, que não pode ser alterado por meio do segredo. Você precisaria alterar o código de .gitHub/workflows/hive_burn_voter.yml. Você pode editar qualquer parte do código, se quiser, e também verificar outras configurações. Mais especificamente, a linha 5 desse script. Esse é o código para o GitHub iniciar o fluxo de trabalho naquele horário. No momento, está configurado como -cron '50 23 * * *', onde o primeiro valor representa os minutos (50) e o segundo as horas (23 = 11). Se você quiser executar às 17h, substitua o 50 por 0 e o 23 por 17. Fácil, não é?


image.png

O arquivo de configuração do fluxo de trabalho.

  Perguntas frequentes e respostas: Suas alterações não serão refletidas no meu repositório original, e minhas alterações serão refletidas no seu repositório somente se você quiser sincronizá-lo. Sua chave de postagem é criptografada com segurança no GitHub. Ela é usada apenas neste mesmo arquivo YAML do fluxo de trabalho com o horário. O script é simples; Não estou capturando o segredo em lugar nenhum e enviando-o para algum lugar. Mesmo para você, a chave de postagem não ficará visível se você clicar para atualizar o segredo; você poderá substituir o valor, mas não saberá exatamente o que está sendo substituído. Portanto, se alguém invadir seu GitHub, não verá a chave de postagem. Por último, mas não menos importante, por favor, me informe sobre quaisquer problemas aqui, no GitHub ou via Discord.

Sort:  

Great to see more hive devs creating ideas

 last month  

Yeah spare vp is always a headache for me… maybe it is also for other people…

What you doing as scientist? You should apply as dev 🤣

 last month  

Lol maybe! It is one option! My current position we had to dev a DB and all the mechanics to insert data there

 last month  

Wow!!! It means that now we can vote someone on a specific time and we can set it at autovote just like we save a draft as a scheduled post..... We can save a user in scheduled to give vote!!!!

!PIZZA
!LADY


View or trade LOH tokens.


@les90, you successfully shared 0.1000 LOH with @gwajnberg and you earned 0.1000 LOH as tips. (4/10 calls)

Use !LADY command to share LOH! More details available in this post.
 last month  

The script will tool for the post of the specifix user in the last 24h ( or the amount of time that you configure) . And will vote everyday in the same time you configure ( here the default is 11:50pm UTC) . So yeah it works a bit different from auto vote here from hive where the user post and you vote at that time. The idea here is to vote just the extra fat when you are innactive :p

 last month  

It's a good idea but i always try to use autovote when I know that I'll be busy in next days 😉

This post was curated by @hive-br team!

banner_hiver_br_01.png

Delegate your HP to the hive-br.voter account and earn Hive daily!

🔹 Follow our Curation Trail and don't miss voting! 🔹

Curious about HivePakistan? Join us on Discord!

Delegate your HP to the Hivepakistan account and earn 90% of curation rewards in liquid hive!

50 HP
100 HP
200 HP
500 HP (Supporter Badge)
1000 HP

Follow our Curation Trail and don't miss voting!

Additional Perks: Delegate To @ pakx For Earning $PAKX Investment Token


Curated by dlmmqb

PIZZA!

$PIZZA slices delivered:
@les90(5/20) tipped @gwajnberg

Please vote for pizza.witness!